我的installshield调用程序是: szString=SUPPORTDIR^"password.dll";
nResult = UseDLL(szString);
nResult = CallDLLFx(szString,"CheakPsword",nValue,szString);
if( nResult = 0 ) then
MessageBox( "error",WARNING);
abort;
endif;
UnUseDLL(SUPPORTDIR^"password.dll");自己写的DLL函数是:extern "C" __declspec(dllexport) LONG CheakPsword(HWND hwnd, LPLONG lpIValue, LPSTR lpszValue)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CCheckPassword *pCheckPw = new CCheckPassword();
if (NULL != pCheckPw)
pCheckPw->DoModal();
delete pCheckPw; return 0;
}
DLL在VC中调用完全正常,但在installshield中调用时执行完CallDLLFx返回报错:Description:Dll function call crashed:ISRT.CallDLLFnSetup will now terminate我看帮助中说自定义的函数的格式必须是
CheakPsword(HWND hwnd, LPLONG lpIValue, LPSTR lpszValue)
但好像传过去的句柄没有用,不知道用来干什么。请大家帮我看看哪里有问题。谢谢。我的环境是installshield6.31、vc6.0
nResult = UseDLL(szString);
nResult = CallDLLFx(szString,"CheakPsword",nValue,szString);
if( nResult = 0 ) then
MessageBox( "error",WARNING);
abort;
endif;
UnUseDLL(SUPPORTDIR^"password.dll");自己写的DLL函数是:extern "C" __declspec(dllexport) LONG CheakPsword(HWND hwnd, LPLONG lpIValue, LPSTR lpszValue)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CCheckPassword *pCheckPw = new CCheckPassword();
if (NULL != pCheckPw)
pCheckPw->DoModal();
delete pCheckPw; return 0;
}
DLL在VC中调用完全正常,但在installshield中调用时执行完CallDLLFx返回报错:Description:Dll function call crashed:ISRT.CallDLLFnSetup will now terminate我看帮助中说自定义的函数的格式必须是
CheakPsword(HWND hwnd, LPLONG lpIValue, LPSTR lpszValue)
但好像传过去的句柄没有用,不知道用来干什么。请大家帮我看看哪里有问题。谢谢。我的环境是installshield6.31、vc6.0
__declspec(dllexport) LONG __stdcall ExitCode (HWND, LPLONG, LPSTR);// this will be function implementation
LONG __stdcall ExitCode (HWND hwnd, LPLONG lpIValue, LPSTR lpszValue)
{
*lpIValue = 5;
strcpy(lpszValue, "Hello World!");
return (12); // add some additional stuff
}And in IS do the following:function MyExitHandler()
STRING szDLL;
NUMBER nValue;
STRING szString;
POINTER pnValue;
POINTER pszString;
begin
// make sure that path to the .dll is correct
szDLL = "C:\\SamplesC++\\Regcrw\\Debug\\Regcrw.dll"; nResult = UseDLL (szDLL);
if( nResult != 0) then
// failure
endif; pszString = &szString;
pnValue = &nValue; szString = "This string will be changed by .dll";
nValue = 10; // as the matter of fact this long will be changed too nResult = CallDLLFx(szDLL, "ExitCode", nValue, szString);
if( nResult = 12 ) then
// fine. Display values of nValue and szString in here
else
// nightmare
endif; nResult = UnUseDLL(szDLL);
if( nResult != 0) then
// failure
endif;
end: