An...@home.com wrote:
> I am tring to use the CallDllFx function in the Free Edition. I must be
> missing something here.
>
> When InstallShield runs in the debugger mode, the statement seems to be
> executed, but apparently does not
> call the DLL. The return value is either -1 or 0 (trying various ways).
> I saw no documentation on what the return values mean.
>
> Any help is appreciated.
>
> Thanks,
> Andy
>
> PS Sorry for the length of this message, I tried to cut it down to the
> minimum.
>
> The script contains the following:
>
> .
> .
> .
> STRING svTest;
> LONG lTest;
> LONG lRet;
> STRING szDll;
>
> begin
>
> //***************************************************
> svTest="Hello There from Install";
> szDll= "C:\\test.dll";
>
> lRet=CallDLLFx (szDLL,
> "TestFunction",
> lTest,
> svTest);
> // ***********************************************
>
> The DLL code contains the following:
> .
> .
> .
> #define DllExport __declspec( dllexport )
> DllExport LONG APIENTRY TestFunction (HWND hwnd, LPLONG lpIValue,
> LPSTR lpszValue);
>
> DllExport LONG APIENTRY TestFunction (HWND hwnd, LPLONG lpIValue,
> LPSTR lpszValue)
> {
> MessageBox(hwnd, lpszValue, "Hello World",MB_OK);
> *lpIValue=101;
> return(1);
> }
>
> From Quick View of DLL:
>
> Exported Function:
> Ordinal Entry Point Name
> 0000 00001000 _TestFunction@12
Craig
//******************************************
InstallShield Code:
lValue = 0;
svValue = TARGETDIR ^ "program.exe";
szDLL = TARGETDIR ^ "install.dll";
szFunction = "ExecuteShellCommand";
CallDLLFx( szDLL , szFunction, lValue, sValue );
/*****************************************/
C DLL (install.dll)
#define INSTALL_API __declspec(dllexport)
/************************************************************************
*
* Function Name: ExecuteShellCommand
*
* Description: This function will create a new process.
*
* Input Parameters: hwnd - The handle of the calling process
* lpValue - 0 - Don't wait for process to end
* - 1 - Wait for process to end
* lpszValue - The command to execute
*
* Return/Exit Values: The exit status of process
*
* Special Logic Notes: NONE
*
*************************************************************************/
INSTALL_API LONG APIENTRY ExecuteShellCommand (HWND hwnd, LPLONG lpValue,
LPSTR lpszValue)
{
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
DWORD dwExitCode = 0;
// Set up the start up info struct.
ZeroMemory(&StartupInfo, sizeof(STARTUPINFO));
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOWNORMAL;
// Launch the process
if (CreateProcess(NULL, lpszValue, NULL, NULL, TRUE,
0, NULL, NULL, &StartupInfo, &ProcessInfo))
{
if (*lpValue == 1)
{
file://Wait for the shelled application to finish:
dwExitCode = WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess, &dwExitCode);
CloseHandle(ProcessInfo.hProcess);
}
else
{
dwExitCode = 1;
}
}
return (dwExitCode);
}
> > I am tring to use the CallDllFx function in the Free Edition. I must be
> > missing something here.
> >
> > When InstallShield runs in the debugger mode, the statement seems to be
> > executed, but apparently does not
> > call the DLL. The return value is either -1 or 0 (trying various ways).
> > I saw no documentation on what the return values mean.
> >
> > Any help is appreciated.
> >
> > Thanks,
> > Andy
> >
> > PS Sorry for the length of this message, I tried to cut it down to the
> > minimum.
> >
> > The script contains the following:
> >
> > .
> > .
> > .
> > STRING svTest;
> > LONG lTest;
> > LONG lRet;
> > STRING szDll;
> >
> > begin
> >
> > file://***************************************************