-
global dll file
Hi all;
i am trying to write a dll file and then use the functions inside it in a exe file. However i am having trouble when i try and include the functions inside the dll file in my exe program. I was wondering if there is a good tutorial/book around that goes into this in detail without the useage of MFC. The dll file has to be global because i am using hooks inside it.
thanks heaps.
-
Okay to add to my question...
in my dll file i have
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
log the keys...
...
return nexthookproc();
}
then in my exe i use
HOOKPROC hookproc;
HINSTANCE dllfile;
HHOOK hhook;
dllfile = LoadLibrary((LPCTSTR) "c:\\PcDll.dll");
hhook = (HOOKPROC)GetProcAddress(dllfile, "HookProc");
hhook = SetWindowsHookEx(WH_KEYBOARD,
hookproc, dllfile, 0);
to load the dll and set the hookproc, however it doesnt seem to work. How do i call HookProc() found inside my dll in my exe?
-
Try this. Change this:
hhook = (HOOKPROC)GetProcAddress(dllfile, "HookProc");
to this:
hookproc = (HOOKPROC)GetProcAddress(dllfile, "HookProc");
-
2 More Things!
You:
A: Forgot __declspec(dllexport) in the dll
B: Forgot that C++ dlls export with argument info:
?HookProc@@blahblahblah
Use dependancy walker to figure out this name.
SPH:cool: