PDA

View Full Version : Disable bringing main installation dialog to front when installing prerequisite



shust87
07-24-2013, 11:02 AM
I want to install one prerequisite before installing product. This prerequisite has several dlls and its own setup.exe which launches its own Installation Wizard (user is asked to enter destination directory, license file etc..).
So I created Custom Prerequisite using Prerequisite Editor and set setup.exe in Application to Run tab there. I built my InstallShield project with this custom prerequisite included and tried to run it...

It works as I expected, but one thing I don't like:
I start main product installation-> it indicates that my Prerequisite should be installed first ->Installation Wizard of my Prerequisite component starts. Then I start moving through this Prerequisite's Installation Wizard instructions (clicking next->next etc...) and suddenly installation dialog of main product is bringing to front. Of course, I can drag main product installation dialog to another place of my screen and finish with Prerequisite installation dialog, but this is not a user-friendly installation way.

So, my question is - how to disable appearing of main installation dialog during running custom prerequisite installation dialog? In other words - user shouldn't have a possibility to continue with main product installation while installation of prerequisite is running!

shivendra
07-24-2013, 12:24 PM
Hi,

If you are launching your preq with LaunchAppAndWait() e.g:

LaunchAppAndWait( ,,, LAAW_OPTION_SET_BATCH_INSTALL | LAAW_OPTION_WAIT );

Then definitely your preqrequiste will installed first and then your main screen comes up.Please let me know if you didnt get your solution.

Thanks,
Shivendra

shust87
07-25-2013, 03:48 AM
shivendra, thanks for your reply, but my InstallShield Project Type is Basic MSI, not InstallScript. Where should I call this function in case of Basic MSI Project? Should I use Custom Action->New installScript? I have so much questions because I've never used InstallScript before.

rguggisberg
07-25-2013, 08:32 AM
Use LaunchAppAndWait as suggested. If you want to hide windows use code something like this in CA to hide and later restore the window.

function MinimizeInstallShield(hMSI)
HWND nHwnd;

begin
nHwnd = FindWindow ("", InsertNameOfYourWindowToMinimize);
SprintfBox (WARNING, "Remove this line later sprintf 1 ", "nHwnd=%d", nHwnd);
if (nHwnd != NULL) then
SendMessage (nHwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
endif;
end;

function RestoreInstallShield(hMSI)
HWND nHwnd;

begin
nHwnd = FindWindow ("", InsertNameOfYourWindowToRestore);
if (nHwnd != NULL) then
SendMessage (nHwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
endif;
SetWindowFocus(); // Bring IS window to front
end;

function SetWindowFocus()
HWND hMain;

begin
hMain = GetWindowHandle( HWND_INSTALL );
//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;

shust87
07-25-2013, 09:07 AM
rguggisberg, thank you for code sample. I believe that LaunchAppAndWait can help me. But the first question for me now is creating appropriate Custom Actions and setting them correctly.
Suppose, I created InstallScript CA and set appropriate Function Name. Which Install Exec Sequence and Install Exec Condition should I enter in my case?

rguggisberg
07-25-2013, 11:33 AM
Place it appropriately (where you want it) in the UI Sequence. No Condition needed.

shust87
07-29-2013, 06:37 AM
rguggisberg, I think hiding and restoring main installation window doesn't help me. I want to suspend main installation process until I finish with installation dialog of my feature. Now I'll try to explain why.

As you know, Windows installers extract some data to C:\users\username\AppData\Local\Temp. What's going on in my situation:
1) I launch main setup.exe
2) C:\users\username\AppData\Local\Temp\{D8725459-0BF7-47A7-818A-13A9F8FFB837} is created
3) I select several features to install (one of them is a feature we're talking about - feature with standalone installer) and click Install button.
4) Installation Wizard of my Feature appears and I see at this moment that other folder C:\users\username\AppData\Local\Temp\{065152E6-58B9-447C-9517-21B28CC6D6C4} is created and setup.exe of my feature is placed there.

I suppose this is an expected behavior of Windows Installers. I start moving through Feature's installation wizard, but suddenly 065152E6-58B9-447C-9517-21B28CC6D6C4 folder's content is cleaned and I'm getting "error occured during the move data process -113". I haven't finished with installing my Feature yet (I see in Feature's installation Wizard that copying files of my features is still in progress), but C:\users\username\AppData\Local\Temp\{065152E6-58B9-447C-9517-21B28CC6D6C4} folder is already cleaned. Why I'm getting such behavior? I suppose temp folders should be cleaned only when I finish installation!

At the same time, if I launch my Feature's setup.exe as a standalone installer (I mean not from my main setup.exe) everything works fine.

rguggisberg
07-29-2013, 11:13 AM
Hiding the screen was just to reduce operator confusion. You still need to LaunchAppAndWait as suggested by shivendra.