|
-
Sep 12th, 2001, 04:10 PM
#1
Thread Starter
Addicted Member
Passing to a dll
Hello Again
I got a simple function working from a dll, but now i can't seem to pass it variables to act on!
Inside my dll i have the function:
int WINAPI InitHooksDll(HWND hwndMainWindow, int nWinLineHeight)
{
hwndMain = hwndMainWindow;
nLineHeight = nWinLineHeight;
InitCalled = 1;
return (0);
}
and I can call the function "test" which has no varibales apssed to it ok, and it is called as follows:
HMODULE hkeyDLL = LoadLibrary("keydll");
if(!hkeyDLL) {
MessageBox(NULL, "Could not load hkeyDLL library", "Error", MB_OK);
return -1;
}
if (hkeyDLL != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hkeyDLL, "Test");
// If the function address is valid, call the function.
if (fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd) ("message via DLL function\n");
// Free the DLL module.
fFreeResult = FreeLibrary(hkeyDLL);
}
How do I alter this code to run the function above (InitHooksDll) and pass it the required variables?!
I don't know whether I have explained myself to well, so if anybody understand could you please shed some light! or If not let me know and I'll try and re-explain myself!
Cheers in advance
Andy
-
Sep 13th, 2001, 10:13 AM
#2
the type of ProcAdd should be defined like this:
Code:
typedef int (WINAPI *PROCPTR)(HWND, int);
Then it should work.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|