动态加载DLL

dumpbin -exports xx.dll // 查看DLL函数名称列表

动态加载DLL

1
2
3
4
5
6
7
8
9
typedef BOOL (_stdcall * SetHook)(HWND);//定义函数指针类型
HINSTANCE hInst;
hHookInst=hInst=LoadLibrary("Hook.dll");//动态加载Dll
SetHook Hook=(SetHook)GetProcAddress(hInst,"SetHook");//获取Dll的导出函数
if (NULL == Hook)
{
MessageBox("加载失败!", "error", 64);
}
FreeLibrary(hHookInst);