cerro79
19th July 2005, 05:34 PM
Hi,
How could I call an dll function using the number instead of name?
undergrid
22nd July 2005, 11:50 AM
You need to get a handle to the module (DLL) that contains the function that you want to call, this is either done via LoadLibrary or GetModuleHandle function calls. You can then call GetProcAddress to get a pointer to the function.
For example assume you want to call:
int testfunc(int param) ;
You can do:
typedef int(* funcptr)(int) ;
hModule = LoadLibrary("dll name") ;
funcptr = GetProcAddress(hModule, MAKELONG(<ordinal>, 0)) ;
ret = funcptr(<param>) ;
Obviously you need to add error handling there, but thats the general idea.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.