假设你有一个dll,文件名yourdll.dll,里面有个函数JustTest(UINT, UINT)
调用的demo如下:
- HINSTANCE hInstance;
- HANDLE (FAR *lpFunction1)(UINT, UINT);
- if ((hInstance = LoadLibrary("yourdll.dll")) == NULL)
- {
- MessageBox("Can not found yourdll.dll!", "Initialization error", MB_OK);
- return FALSE;
- }
- lpFunction1= (HANDLE (FAR*)(UINT, UINT))GetProcAddress(hInstance, "JustTest");
- if (lpFunction1== NULL)
- {
- MessageBox("Fail to load function JustTest!", "Initialization error", MB_OK);
- return FALSE;
- }
如果Load成功,就可以直接调用(*lpFunction1)(UINT, UINT)了,这个就是你的JustTest。
你好好看下MSDN,很快就能学会的。