This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Bring Suite Window to Front
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 30, 2015
03:02 PM
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!
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!
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 19, 2016
09:16 PM
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 28, 2016
10:32 AM
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;
///////////////////////////////////////////////////////////////////////////////
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;
///////////////////////////////////////////////////////////////////////////////
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 29, 2016
06:51 AM
Thank you for sharing !
regards
Markus
regards
Markus
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 29, 2016
10:26 AM
MarkusLatz wrote:
Thank you for sharing !
Seconded! Useful bit of code to keep in your backpocket. Thank you.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 28, 2016
03:57 AM
It is working as expected and Thanks a lot for this code 🙂
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)