dll调用

来源:互联网 发布:js高德地图轨迹清除 编辑:程序博客网 时间:2024/04/30 16:52
void CSetupDlg::OnSetupBtn() 
{
// TODO: Add your control notification handler code here


typedef void (*PFUN)();
HMODULE hModule = ::LoadLibrary(_T("VnetSetupDLL.dll"));
if(hModule == NULL)
{
::FreeLibrary(hModule);
AfxMessageBox(_T("1"));
return ;
}
PFUN newfun = (PFUN)::GetProcAddress(hModule,"OnButton1");
if(newfun == NULL)
{
::FreeLibrary(hModule);
AfxMessageBox(_T("2"));
return ;
}
newfun();  
::FreeLibrary(hModule);
}
原创粉丝点击