Re: Help Needed Using DLL
GetProcAddress(hinstDLL, L"MyMouseProc");
You aren't assigning anything this. You need assign the function pointer.
Code:
hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, L"MyMouseProc");
You just need to cast the GetProcAddress to whatever your function prototype is, you can define your own function pointers for this.
What you were doing is just loading the procedure but it wasn't stored anywhere. Now you call hkprcSysMsg like you would the DLL function itself.
Re: Help Needed Using DLL
Quote:
Originally Posted by
varundua
Code:
GetProcAddress(hinstDLL, L"MyMouseProc");
Have I done any error in making the dll ?
How did you even compile that? GetProcAddress doesn't take pointer to a wide string.
To Notsosuperhero: although you are right, the cast you suggested won't help to fix OP's error "The Specified Procedure cannot be found".
Re: Help Needed Using DLL
either it's this or hes using multi-byte character set.
Re: Help Needed Using DLL
Quote:
Originally Posted by
Cha0sBG
either it's this
or hes using multi-byte character set.
Not sure what do you mean.
1. The (HOOKPROC) cast has nothing to do with the error.
2. Regardless of whether UNICODE was used or not, the GetProcAddress() function is only available in one flavor (unlike many other API function); it doesn’t take a wide string, and the prefix L in front of the text literal explicitly means: wide.
Re: Help Needed Using DLL
It does take a wide string under CE.
gg
Re: Help Needed Using DLL
use Depends.exe from "Microsoft Visual Studio 8\Common7\Tools\Bin" and check you dll to see if the name of your exported function is the same...
Re: Help Needed Using DLL
Quote:
Originally Posted by
Codeplug
It does take a wide string under CE.
You are correct. I didn't know that. In my defence, if there would be any mention of WinCE - I would stay out of this thread.
Re: Help Needed Using DLL
Quote:
Originally Posted by varundua
Code:
extern "C" __declspec(dllexport) LRESULT CALLBACK MyMouseProc(int,WPARAM,LPARAM);
. . .
The program compiles well but on debuggin gives the error "The Specified Procedure cannot be found"
The Program is unable to find the procedure
"MyMouseProc" in the dll
With this declaration the exported name must be _MyMouseProc@12.
Besides, I cannot see any reason to resolve dll entry explicitly. Why don't you go with .lib?
Re: Help Needed Using DLL
Quote:
Originally Posted by
Notsosuperhero
GetProcAddress(hinstDLL, L"MyMouseProc");
You aren't assigning anything this. You need assign the function pointer.
Code:
hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, L"MyMouseProc");
You just need to cast the GetProcAddress to whatever your function prototype is, you can define your own function pointers for this.
What you were doing is just loading the procedure but it wasn't stored anywhere. Now you call hkprcSysMsg like you would the DLL function itself.
I have tried this but doesn't helped , so i removed it but of no use.
Re: Help Needed Using DLL
I have made a slight change but it doesn't help
Code:
hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, TEXT("_MyMouseProc@12"));
if(hkprcSysMsg == NULL)
errormessage();
Re: Help Needed Using DLL
Quote:
Originally Posted by
Igor Vartanov
With this declaration the exported name must be _MyMouseProc@12.
Besides, I cannot see any reason to resolve dll entry explicitly. Why don't you go with .lib?
_MyMouseProc@12 doesn't works either. I am using the dynamic linking since i have to create a System Wide Mouse Hook to check mouse clicks on desktop.
1 Attachment(s)
Re: Help Needed Using DLL
Quote:
Originally Posted by
codecX
use Depends.exe from "Microsoft Visual Studio 8\Common7\Tools\Bin" and check you dll to see if the name of your exported function is the same...
I used the tool it showed the function name as MyMouseProc. I still don't know what to do ??
I am attaching the result of the depend.exe with this reply
2 Attachment(s)
Re: Help Needed Using DLL
Quote:
I used the tool it showed the function name as MyMouseProc. I still don't know what to do ??
Say the truth is what to do. Either you miss (or cripple somehow) the CALLBACK modifier in your dll, or you use .def file that unmangles the exported name.
See my sample, and you see all works fine so far.
Re: Help Needed Using DLL
Quote:
Originally Posted by
VladimirF
You are correct. I didn't know that. In my defence, if there would be any mention of WinCE - I would stay out of this thread.
Vladimir, in your defence: there could not be a mention of WinCE, as there are no hooks in there. :)
Re: Help Needed Using DLL
Quote:
Originally Posted by
Igor Vartanov
Vladimir, in your defence: there could not be a mention of WinCE, as there are no hooks in there. :)
Thank you! Thats's a good news. :wave:
Then what about my post #5 above? How the OP's code was compiled? :confused:
Re: Help Needed Using DLL
Quote:
Originally Posted by
Igor Vartanov
Say the truth is what to do. Either you miss (or cripple somehow) the CALLBACK modifier in your dll, or you use .def file that unmangles the exported name.
See my sample, and you see all works fine so far.
thanx Igor
I removed the extern modifier from the .h and .cpp file and then buid the dll the function name was shown as "?MyMouseProc@@YGJHIJ@Z" and then i used the .c file to use that dll
anywayz thanx a lot