Call a function in a DLL
-
I've created a DLL but how can I call all my functions in that DLL from an EXE? ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
-
I've created a DLL but how can I call all my functions in that DLL from an EXE? ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
-
I've created a DLL but how can I call all my functions in that DLL from an EXE? ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
-
MFC or ATL? Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975Well, I want to do it with Win32 or MFC. Can you show me in Win32, do that! :) ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
-
I've created a DLL but how can I call all my functions in that DLL from an EXE? ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
Hello, the codegurus around the world. ;) There are at lease two ways to call the functions in DLL. One is to use LoadLibrary and GetProcessAdoc(?) to get the address of the function in DLL. The other way is to implicity call the function in DLL by registering the function name in DLL at def file. Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
-
Well, I want to do it with Win32 or MFC. Can you show me in Win32, do that! :) ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
So you mean you use Win32 Dynamic-Link Library project ro write dll? So first as you now you have to register your dll. include your yourdll_idl.h and yourdll_idl_i.c in your class,then you can use your methos: Is that enough or you need more? Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
Hello, the codegurus around the world. ;) There are at lease two ways to call the functions in DLL. One is to use LoadLibrary and GetProcessAdoc(?) to get the address of the function in DLL. The other way is to implicity call the function in DLL by registering the function name in DLL at def file. Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
Aah! The first way you said was exactly what I was looking for! I post a new message if I get some trouble with the functions... thnx ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
-
Hello, the codegurus around the world. ;) There are at lease two ways to call the functions in DLL. One is to use LoadLibrary and GetProcessAdoc(?) to get the address of the function in DLL. The other way is to implicity call the function in DLL by registering the function name in DLL at def file. Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
Well, I have a question right now: What kind of type will my varible that holds the address have? I can't declare a: FARPROC myfunc = GetProcAddress(....); and then call my function: myfunc(); ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
-
Well, I have a question right now: What kind of type will my varible that holds the address have? I can't declare a: FARPROC myfunc = GetProcAddress(....); and then call my function: myfunc(); ------------------------------------ Rickard Andersson, Suza Computing ICQ#: 50302279 I'm from the winter country SWEDEN! ------------------------------------
Declare a function pointer that has the same prototype of the function that you want to call: Example:
// If the DLL function looks like this: int GetWindowText(HWND hWnd, LPTSTR lpString, int nMaxCount); //Define this function pointer: int (*GetWindowTextPtr)(HWND, LPTSTR, int); // Now with your code you can do this. FARPROC myfunc = GetProcAddress(....); GetWindowTextPtr func = (GetWindowTextPtr)myfunc; myfunc(hWnd, szString, count);