Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetProcAddress 1

Status
Not open for further replies.

skoko

Programmer
Feb 11, 2002
188
US
How I can call function from DLL by ordinal?
 
If you know the ordinal, you can do something like this:

[tt]#define MYORDINAL 168
typedef void (*FUNCTIONPTR)(int,int);

// find the funtcion
HMODULE hmod = LoadLibrary("MyLibrary.DLL");
FUNCTIONPTR myFunc = GetProcAddress(MAKELONG(MYORDINAL,0));

// execute the function now
myFunc(0,0);[/tt]

Ordinal @168 is an example. Also I assumed that your function had two parameters of type int.

I REALLY hope that helps.
Will
 
I get this error for GetProcAdress:
Cannot convert parameter 2 from 'long' to 'const char *'
 
(const char *)MAKELONG(MYORDINAL,0)

and it work great

Thank You!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top