|
poda123 wrote: Could you please help me out to run your application,where
I can learn more things out there.
Do you have latest platform sdk installed?
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi,
I have downloaded and installed the version
Microsoft® Windows Server 2003 R2 Platform SDK - March 2006 Edition.
But still I get the same error.
If there is a newer version,please send me the link.
Thanks!
|
|
|
|
|
poda123 wrote: I tried to execute the process viewer,
but could not run due to the error message
"...desktop\procviewer\utils.h(829) : error C2065: 'SLR_NOSEARCH' : undeclared identifier"
This makes no sense. C2065 is a compiler error, which means you would not have had a Process Viewer executable.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Here's a program I knocked up which lists the functions exported by name from a dll:
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <Imagehlp.h>
#pragma comment(lib, "Imagehlp.lib")
using namespace std;
int main(int argc, char* argv[])
{
if (argc!=2)
{
cerr << "Usage:\n\tExports <path to dll>" << endl;
return 1;
}
LOADED_IMAGE li;
BOOL bOK = MapAndLoad(
argv[1],
NULL,
&li,
TRUE,
TRUE
);
if (!bOK)
{
cerr << "MapAndLoad failed!" << endl;
return 2;
}
DWORD expVA = li.FileHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
PIMAGE_EXPORT_DIRECTORY pExp = (PIMAGE_EXPORT_DIRECTORY)ImageRvaToVa(
li.FileHeader,
li.MappedAddress,
expVA,
NULL
);
DWORD rvaNames = pExp->AddressOfNames;
DWORD *prvaNames = (DWORD*)ImageRvaToVa(
li.FileHeader,
li.MappedAddress,
rvaNames,
NULL
);
for (DWORD i=0; i<pExp->NumberOfNames; ++i)
{
DWORD rvaName = prvaNames[i];
const char *pName = (const char*)ImageRvaToVa(
li.FileHeader,
li.MappedAddress,
rvaName,
NULL
);
cout << pName << endl;
}
UnMapAndLoad(&li);
return 0;
}
Steve
modified on Wednesday, February 13, 2008 10:58 PM
|
|
|
|
|
Awesome!
Thanks a lot Steve for your help.
Thank you so much!
|
|
|
|
|
Could you please share how did you come up
with such a nice code to export dll functions.
Any website reference?
Thanks!
|
|
|
|
|
Many years ago I read this[^] and this[^]. The "WinNT.h" header file is also informative.
Steve
|
|
|
|
|
HI,
i'm trying to derive from an Interface that looks like this (the iport.h):
<br />
<br />
#ifndef _PORT_<br />
#define _PORT_<br />
#pragma once<br />
<br />
class IPort<br />
{<br />
public:<br />
IPort(int pi): portId(pi) {}<br />
~IPort(void) {}<br />
<br />
virtual int Send(const void * data , int len, int cNum = 0 , short mId = 0 )=0;<br />
virtual int InitPort(void) = 0;<br />
virtual int ClosePort(void) = 0;<br />
virtual int BindAndConnect(void) = 0;<br />
<br />
int GetPortId(void)<br />
{<br />
return portId ;<br />
}<br />
<br />
protected:<br />
<br />
int portId;<br />
};<br />
#endif<br />
my class is as sipmale as can get(the *.h) :
<br />
#pragma once<br />
#include "iport.h"<br />
<br />
class _COM :<br />
public IPort<br />
{<br />
public:<br />
_COM(void);<br />
_COM(int port, int rt);<br />
public:<br />
~_COM(void);<br />
<br />
private:<br />
int portNumber;<br />
int RT_Number;<br />
};<br />
But It Keeps thorwing my the TITLE error
for the .cpp file:
#include "_COM.h"<br />
<br />
_COM::_COM(void)<br />
{<br />
}<br />
<br />
_COM::_COM(int port, int rt):portNumber(port),RT_Number(rt)<br />
{<br />
<br />
}<br />
<br />
_COM::~_COM(void)<br />
{<br />
}
What am i'm missing?
THANKS
Have Fun
Never forget it
|
|
|
|
|
half-life wrote: _COM::_COM(void)
That is your problem: your base class (IPort) doesn't have a default constructor, so you are required to call its constructor and provide a value to it. Within your default _COM constructor, you need to call the constructor of IPort and passing a parameter to it.
|
|
|
|
|
Yep Indeed, THAMKS A lot
Have Fun
Never forget it
|
|
|
|
|
Your interface contains state (the member variable int portId ).
Is that really intended?
Also, you probably should make the d'tor virtual. Also the portIt-getter.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hello Gurus
I have an application in VC++ in which i'll show the rtf file in Rich EDit Ctrl , i completely success to show the file , but the problem is when i make a DLL of that exe application there is an exception in the Dll
i had make a DLL (Regular MFC static Linked Dll) in which i'll pass the
HInstance ,and path of the file
like this
extern __declspec(dllexport)bool RTFDisplay::ShowFilePreview(HINSTANCE ist,TCHAR *csFilePath ,void *FileInfo, BYTE bFileType ,TCHAR *csImagePath)
{
CRTFViewerApp *pApp = (CRTFViewerApp*)AfxGetApp() ;
dll_inst=ist;
HINSTANCE cur=GetDllInstanceHandle();
AfxSetResourceHandle( cur );
if(bFileType == RTF_FILE )
{
CRichPreviewDlg Ob ;
Ob.m_csFilePath = csFilePath ;
Ob.m_FileInfo = (tagFileInfo*)FileInfo ;
Ob.m_csImagePath = csImagePath ;
Ob.DoModal();
}
AfxSetResourceHandle( dll_inst);
return pApp->m_bRetVal;
}
When i run this DLL there is an exception Debug Assertion Fail , when i get into the code then i found "HINSTANCE cur of GetDllInstanceHandle();" has NULL value.and after this error promt
I had make so many DLL earlier with "textctrl" , "listctrl" but i can't face such type of problem
Kindly Look into the matter
Thanks
|
|
|
|
|
Thank you for your reply in advance
When i run my project(MFC) in debug mode it is workiing fine but when i do it in
release mode it is not runnig. But when i run the exe in RELEASE folder it is working fine.Can anyone give me a solution to run my project in release mode through my code itself
|
|
|
|
|
Can you elaborate on "it is not running"?
|
|
|
|
|
Certainly - just include this function call at the start of your program:
invoke_psychic_and_magic_wand (17)
Didn't they teach you anything at the programmer's initiation ceremony?
More seriously, you have a bug in your code. The solution is to fix it.
You can run release code under the debugger to find out how it's crashing. Or use depends.exe to find out why it doesn't even run to start with.
The big thing that caught me was a stack overflow. I tracked it down to using a wrong signature for a message function.
I had:
ON_COMMAND(IDC_1234, OnButton1234)
then
void CMyDialog::OnButton1234 (UINT nID)
instead of
void CMyDialog::OnButton1234 (UINT nID)
This will take you some time to track down - but the error didn't manifest in debug mode.
I'm sure there are lots more examples.
And yes, I have more meaningful names in my code than 1234 and CMyDialog!
Good luck,
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Have you seen this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All
when i m trying to debug my Dlg Base Application, straight it is going disassemly File as my cursor come to the dlg Box. can i have any solution?
i am using VC++ 2005
Thanks in advance
RYK
modified on Wednesday, February 13, 2008 2:11 AM
|
|
|
|
|
Did you build your project in debug mode ? If not, then that is probably your problem.
|
|
|
|
|
Hello,
I wanted to create 3D vector but i don't know how.
Hope somebuddy can help me.
1D: std::vector<int> v1;
2D: std::vector<std::vector<int>> v2;
Follow up question, how can i copy 3D vector;
Your comments will be a big help.
Thank you.
|
|
|
|
|
hi,
std::vector are not equal to graphical vectors. The std::vector is like an Array or list.
You should create your own points.
struct Vector2d
{
int x;
int y;
};
AND
struct Vector3d
{
int x;
int y;
int z;
};
struct Vector3d : public Vector2D
{
int z;
};
codito ergo sum
|
|
|
|
|
In my application there are 4 panes created through CSplitterWnd class.on these panes i want a close button like the one provided in panes of outlook express so as to hide nad unhide these panes.i m not getting a way to do this...plz suggest
|
|
|
|
|
It's going to involve work for you, but have a look at
CSplitterWnd::DeleteColumn and CSplitterWnd::SplitColumn.
If you have a 2x2 arrangement, then you're not really going to be able to remove just one view.
I'd also be tempted to not use CSplitterWnd. If you search through codeproject, you should be able to find a few articles showing how to do the "new" [*] outlook look.
Iain.
[*] well, it was new in 2003...
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Hi all,
On of my class have a char pointer as follows.
char* message;
In another class I create an instance as pointer type. Then I want to create a string. So I do this.
string str = pInMsg->message;
where pInMsg is the object to the first class.
Is that wrong, I've try to debug and see, make me too wired that. Can you guys help me on that.
I appreciate your help all the time...
Eranga
|
|
|
|
|
It is correct there is one more way to do it is
string str(pInMsg->message);
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Yes, an alternative way.
My question is, only I got the first character. Not all the characters there?
I appreciate your help all the time...
Eranga
|
|
|
|