Cannot convert 'int (__stdcall *)()' to 'int (__stdcall *)(AnsiString *)' 为什么会有这样的问题呢?
mbj 2005-05-09 10:29:16 我在头文件中有以下声明:
private:
int _stdcall (*ShowDLLForm)(AnsiString *);
然后在实现中调用
bool TMainForm::LoadDLLFun(char *DLLName,char *FunName)
{
HINSTANCE instDLL;
try{
if(instDLL!=NULL)
{
FreeLibrary(instDLL);
instDLL=NULL;
instDLL=LoadLibrary(DLLName);
if(instDLL!=NULL)
{
ShowDLLForm=GetProcAddress(instDLL,FunName);
if(ShowDLLForm==NULL)
{
Application->MessageBoxA("动态链接库运行发生错误\n","错误",MB_OK);
// ShowMessage("动态链接库运行发生错误\n");
// FreeLibrary(instDLL);
return false;
}
}
}
else
{
AnsiString AppPath=GetCurrentDir();
instDLL=LoadLibrary(DLLName);
if(instDLL!=NULL)
{
ShowDLLForm=GetProcAddress(instDLL,FunName);
if(ShowDLLForm==NULL)
{
ShowMessage("动态链接库运行发生错误\n");
// FreeLibrary(instDLL);
return false;
}
}
}
}//try
catch(Exception &Err)
{
ShowMessage("加载动态链接库发生错误!\n" + Err.Message);
}
return true;
}
但是编译的时候确给我这样的提示:
[C++ Error] Main.cpp(31): E2034 Cannot convert 'int (__stdcall *)()' to 'int (__stdcall *)(AnsiString *)'
[C++ Error] Main.cpp(49): E2034 Cannot convert 'int (__stdcall *)()' to 'int (__stdcall *)(AnsiString *)'
为什么会这样呢,请高手指点!!