Bring Suite Window To Foreground

Bring Suite Window To Foreground


Information on how to bring a suite dialog to the foreground


You may encounter a situation where your suite installer window appears behind another window. If this is the case, this knowledge base article will show you a way you can force the suite window to the foreground using an InstallScript action.


This example will be using an InstallScript action to bring the suite dialog to the foreground. The code itself uses api calls to bring the window to the foreground, but it's the FindWindow() call that will locate the suite dialog to bring to the foreground.

NOTE: FindWindow() will use #32770 to specify the class for a dialog box (...the suite dialog). However to look for your specific suite dialog (...and not some other dialog window), you will want to look for the specific window name for your suite project (...for example "MyProjectName - InstallShield Wizard").

Once you have your InstallScript action in place, you can go to the dialog(s) in question and under the 'Events->Page Entered' you can add 'Run a Suite Action' and call the above InstallScript action. This will ensure that when the dialog is displayed it will be brought to the foreground.


You can add the following code in your suite project under 'Behavior and Logic->InstallScript'...
export prototype SetWindowFocus(OBJECT);

prototype USER.AttachThreadInput( HWND, LONG, BOOL );
prototype USER.GetWindowThreadProcessId( HWND, LONG );
prototype KERNEL.GetCurrentThreadId();
prototype HWND USER.GetForegroundWindow();

function SetWindowFocus(oExtension) 
    HWND hMain; 
    hMain = FindWindow("#32770", "MyProjectName - InstallShield Wizard"); 
    if (hMain != NULL) then 
        SendMessage (hMain, WM_SYSCOMMAND, SC_RESTORE, 0); 

    //Attach foreground window thread to installation thread 
    AttachThreadInput( GetWindowThreadProcessId( GetForegroundWindow(), NULL ), GetCurrentThreadId(), TRUE ); 

    //Bring to foreground 
    SetWindowPos( hMain, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ); 
    SetForegroundWindow( hMain ); 

    //Detach the attached thread 
    AttachThreadInput( GetWindowThreadProcessId( GetForegroundWindow(), NULL ), GetCurrentThreadId(), FALSE ); 
    SetFocus( hMain ); 

Additional Information

For more information on how to use actions in your suite project you can look at the following help document, Using Actions to Extend the Behavior of a Suite/Advanced UI Installation.
Was this article helpful? Yes No
No ratings
Version history
Revision #:
1 of 1
Last update:
‎Jul 12, 2018 09:48 PM
Updated by: