首页 > 代码库 > 2015.3.3 VC6调用dll

2015.3.3 VC6调用dll

用VC新建一对话框工程,在一按钮点击事件中添加如下代码:

typedef void (WINAPI * TESTDLL)();

HINSTANCE hmod;

hmod = ::LoadLibrary ("my.dll");

if(hmod==NULL)

{

  AfxMessageBox("Fail");

}

TESTDLL lpproc;

lpproc = (TESTDLL)GetProcAddress (hmod,"Show");

if(lpproc!=(TESTDLL)NULL)

  (*lpproc)();

FreeLibrary(hmod);

2015.3.3 VC6调用dll