Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CallDllFx - Can't get to work

17 views
Skip to first unread message

Anthony Zakgaim

unread,
Jun 1, 2000, 3:00:00 AM6/1/00
to
My thoughts:
1.According to function declaration it expects a pointer to a long as 2nd
argument and a pointer to a string as 3rd.
Whatever value you pass in, you pass them by value insted passing
there addresses.
2. I would substitute APIENTRY with __stdcall

muddana

unread,
Jun 1, 2000, 3:00:00 AM6/1/00
to
hhh

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

mkrishna.vcf

Craig

unread,
Jun 9, 2000, 3:00:00 AM6/9/00
to
It looks good to me. I'm doing something very similar which works perfectly.
My code is below. Are you sure it is finding the DLL? Try fully qualifying
the path (which is what I do).

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://***************************************************

0 new messages