首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VC >

vs2008 动态调用dll疏失

2012-12-26 
vs2008 动态调用dll出错#include stdafx.h#include windows.h//#include Wincrypt.h#include crypt

vs2008 动态调用dll出错
#include "stdafx.h"
#include <windows.h>
//#include <Wincrypt.h>
#include <cryptdlg.h>
 
int _tmain(int argc, _TCHAR* argv[])
{
 typedef BOOL(__stdcall* fun)(PCERT_SELECT_STRUCT_W pCertSelectStruct);
 fun new_fun;
 HMODULE  hModule = LoadLibrary(TEXT("CryptDlg.dll "));
 if (hModule)
 {
  new_fun = (fun)GetProcAddress(hModule, "CertSelectCertificate");
  
 }
 new_fun(NULL);
 free(hModule);
}
 
 
 
testdlg.exe 中的 0x00000000 处未处理的异常: 0xC0000005: Access violation
出错位置:
new_fun(NULL);
 
在线等解决
[解决办法]
先判断一下你的代码有无问题
new_fun = (fun)GetProcAddress(hModule, "CertSelectCertificate");
看看new_fun 是否获取到
如果获取到,看看是否那个dll内部的问题

热点排行