PDA

View Full Version : Please Help me: Trying to author a DLL to display a modeless dialog



ABhatnagar
11-04-2003, 09:24 AM
As the subject says I am trying to display a modeless dialog using a DLL function called by the MSI. This is done very easily in InstallScript using sdShowMsg.

I can not use an MFC based dll and when using 'createdialog' the MSI install hangs during the message loop. The reason why this must be a modeless dialog as opposed to a 'MessageBox' is because the dialog should not have any buttons for the end user to press. It is just informational while a createprocess is occuring.

The reason why I am avoiding InstallScript is because we are attempting to replace it with a DLL so that we are not dependent upon ISScript.msi and the version installed on the system.

Can anyone help provide me a coding example, I have searched the web and have found nothing that would help me call this from a DLL. Using an EXE I can easily create a dialog because the WinMain is being used.

philiph
11-04-2003, 10:29 AM
It looks like you are using VC++ ?? Do you have Delphi?

ABhatnagar
11-04-2003, 10:43 AM
I am using Visual Studio 6 and no I do not have Delphi. :)

oliverb
11-04-2003, 10:50 AM
Not sure if this would help you, but give it a try....

The only thing I would suggest is that you change the dialog I am including in the project to display only a message and change the code to just launch your process and set the delay accordingly.

I don't think it is quite exactly what you are looking for but, it should be a good template where to start from.

Good Luck,

oliverb
11-04-2003, 10:51 AM
BTW, you'll need Visual C++ 6.0 to open the workspace file

ABhatnagar
11-04-2003, 10:53 AM
Thank you, I will try it right now.

ABhatnagar
11-04-2003, 10:57 AM
Question: In the MSI would I just call the function 'DllMain' ?

oliverb
11-04-2003, 11:07 AM
When you are making the call to EzDefineDialog, you will specify (the system variable) ISUSER, which the InstallScript engine will interpret as your _IsUser.dll, containing your custom dialog.

If you follow the Sample Code.txt, you should be able to see it.

Let me know if you need anything else.

ABhatnagar
11-04-2003, 11:09 AM
Now I understand why this is not working. I am trying not to use InstallScript, but rather a custom action to just call the function from the dll. Like this, but of course this is not working either:


BOOL CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);

UINT __stdcall Install(MSIHANDLE hInstall)
{



HWND hDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MODELESS_DIALOG), NULL, DlgProc);

ShowWindow(hDlg,SW_SHOW);

MSG msg;

BOOL bRet;

while ( (bRet = GetMessage(&msg, NULL, 0, 0)) != 0 )

{
if (bRet == -1 )
{
// handle the error and possibly exit
}

else if (!IsWindow(hDlg) || !IsDialogMessage(hDlg, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}


return ERROR_SUCCESS;
}


BOOL CALLBACK DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
// Post the WM_QUIT message to
// quit the application terminate.
PostQuitMessage(0);
return 0;

break;
}

return FALSE;

}

ABhatnagar
11-04-2003, 11:11 AM
Any other thoughts or suggestions?

oliverb
11-04-2003, 11:14 AM
Sorry... I don't know much C++, so I cannot help you there.

ABhatnagar
11-04-2003, 11:15 AM
That makes two of us :D

Thank you for trying though.