有一个叫做“Scenario File.dll”的动态链接库文件
在接口声名中有这样一个函数声名
[id(9), helpstring("method CloseFile")] HRESULT CloseFile();
我做了一个程序,想调用这个函数,调用部分代码如下
typedef HRESULT(* CloseFile)();
HINSTANCE h=LoadLibrary("Scenario File.dll");
if (h==NULL)
{
MessageBox("DLL Can't find!");
return TRUE;
}
CloseFile lpCloseFile;
lpCloseFile=(CloseFile)GetProcAddress(h,"CloseFile");
if(lpCloseFile==NULL)
{
MessageBox("Function Can't find!");
return TRUE;
}
编译能通过,运行的时候,会报 Function Can't find!
也就是打开dll成功了,但是函数却没找到,这是怎么回事啊?
我把 typedef HRESULT(* CloseFile)(); 改成 typedef (* CloseFile)();
也一样不行
大侠们救救我吧,谢谢了