Loading
Bring Suite Window to Front
My Suite Window is often hidden behind other windows. How do I bring it to the front? I tried an InstallScript event.

 

export prototype SetWindowFocus(OBJECT);

 

function SetWindowFocus(oTest)

 

HWND hMain;

 

begin

 

hMain = GetWindowHandle( HWND_INSTALL );

 

SetForegroundWindow( hMain );

 

end;

 

I know it is getting executed because if I put it in 'OnBegin' (illegal because there is no UI yet) it exits the install. If I put it in OnStaging or later it seemingly does nothing.

 

OK.. it seems like the proper place for it to be scheduled is as a 'Page Entered Event' on the InstallWelcome page (at least for a first install). So it is executing in the proper place according to the log. Now to make it the above script actually work :(

 

Thanks for any ideas!

  • Kicking this to the top of the pile.

     

    What is causing the Suite window to be in the background is that I launch a bat file in OnBegin to check versions of 3rd party apps, SQL instances, etc and log info about all of that. In the bat I PAUSE if there are any items that I need to warn the user about. So if I PAUSE, the Suite window remains in the background even after closing the bat file. If I do not PAUSE the Suite window is in the foreground. Anybody have any ideas?

     

    Thanks
    Expand Post
  • Thanks to Phil at Flexera Support I have this working using the InstallScript code below.

     

    I then created a Events Action named SetWindowFocus and run that action as a 'Page Entered' event on the appropriate Wizard Page.

     

    Thanks Phil!

     

    ///////////////////////////////////////////////////////////////////////////////

     

    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;

     

    begin

     

    hMain = FindWindow("32770", "");

     

    if (hMain != NULL) then

     

    SendMessage (hMain, WM_SYSCOMMAND, SC_RESTORE, 0);

     

    endif;

     

    //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 );

     

    end;

     

    ///////////////////////////////////////////////////////////////////////////////
    Expand Post
  • " MarkusLatz wrote:

     

    Thank you for sharing !

     

    "

     

    Seconded! Useful bit of code to keep in your backpocket. Thank you.
    Expand Post

Loading
Bring Suite Window to Front