cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
elvinhau
Level 3

Hide Current Dialog (Basic MSI)

hi,

I need to hide current dialog (below example) and show SdShowMsg using Basic MSI project:

[FONT="Courier New"]function MyFunction(hMSI)
STRING szMsg;

begin
szMsg = "Please wait ...";
SdShowMsg (szMsg, TRUE);

//Attempt to hide current dialog in 3 possible ways but failed ???
Disable(DIALOGCACHE);
EndDialog("SQLLogin");
ShowWindow(hMSI, FALSE);


LaunchAppAndWait("xxx.exe", "", LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN);

SdShowMsg (szMsg, FALSE);
end;
[/FONT]

It never works .. Can anyone help me ? Thanks
Labels (1)
0 Kudos

(4) Replies
elvinhau
Level 3

Wasted more than half day just try to solve this problem. Look through most related posts in this forum but without success.

I urgently need to solve this problem. So far, still cannot hide or disable current dialog after it fired some custom action (with installscript).

Getting disappointed. Can someone advise if this is doable in basic msi ?
0 Kudos
hidenori
Level 17

Unfortunately, there's not a good way to do that when mixing InstallScript and MSI dialog boxes. Disable(DIALOGCACHE) and EndDialog are only for InstallScript dialog boxes; in ShowWindow, hMSI is the MSI handle and not a window handle.

One option might be to call FindWindow to get the MSI window handle (Spy++ will give the MSI window class name to use in FindWindow), and then use that window handle in Windows APIs or SendMessage to minimize the window or something.

If skipping InstallScript is an option, you could look into the SpawnWaitDialog control event to pop up a temporary status window that covers the awhile the asynchronous action is taking place.
0 Kudos
brianthegood
Level 6

Is it possible that the 'SdShowMsg (szMsg, FALSE)' has not been called because the LaunchAppAndWait still has not finished?

Consider putting a Delay(10) and then the second SdShowMsg before the call to LaunchAppAndWait.
0 Kudos
elvinhau
Level 3

Thank you very much, hidenori, I try your first option and the problem is solved in less than 10 minutes.

To share it out, this is what I do:

Step 1:
I got the SPY tool to get current dialog window handle. So, I get hwnd: "MsiDialogCloseClass".

Step 2:
I modified the code as below:

[FONT="Courier New"]function MyFunction(hMSI)
STRING szMsg;
HWND hwnd;

begin
szMsg = "Please wait ...";
hwnd = FindWindow("MsiDialogCloseClass","");
SdShowMsg (szMsg, TRUE);
EnableWindow(hwnd,FALSE);
ShowWindow(hwnd, FALSE);


//do whatever you want with installscript
LaunchAppAndWait("xxx.exe", "", LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN);

SdShowMsg (szMsg, FALSE);

//Optional line if not stay in current dialog
ShowWindow(hwnd, TRUE);

end;
[/FONT]

Now, installscript can intercept the basic msi dialog and works in sync happily. 🙂

p/s: brianthegood: Hidenori has pointed out the main reason. Thanks for your kindness to help too.
0 Kudos