Archive: Hiding ExecWait windows


Hiding ExecWait windows
  My installer uses ExecWait quite a bit and some of the programs that it executes take a lot of time to execute, thus the console window sits in the foreground for long periods of time. Is there a possiblity that one of the following things could be added to the installer to make ExecWait a little cleaner:

* Hide the console window
* Minimize the console or place it behind the installer window
* Fire up a nice message box with a message that explains to the user what it is doing during the wait like "Starting MySQL Daemon ..."

Warm regards,

Brent

By the way, this issue has been brought up before with no results: http://forums.winamp.com/showthread....threadid=77705


What you can do is excute the program with Exec and not ExecWait and then find its window with FindWindow. Then you should call BringToFront to bring the installer back to front, show some install options dialog that says installing whatever or just printing it in the details, and finally enter into a loop waiting for the window to close (using FindWindow and waiting for it to return zero).

To just hide it you can create a shortcut for it and execute it with ExecWait.


I tried your solution but it still is unsatisfactory. To the user the console still flashes to screen before going to the background and the installer seems like it is frozen (to an ordinary user) while the command is running. I believe that the solution to this problem will require some enhancements to the ExecWait code base.

Justin, could you please look into this, or point me in the right direction so I can add something like this myself?

Thanks and warm regards,

Brent


If you are running DOS commands, you need to create a dll extension to execute the program and pump the output to the program and not to a console window.


[edit]rainwater's idea seems better than mine :up: [/edit]

How aobut this:

DetailPrint "Executing whatever, please hold..."

>SetDetailsPrint none
GetTempFileName $R1
StrCpy $R1 "$R1.lnk"
>CreateShortcut $R1 "whatever dos command you want" "paramaters" "" "" SW_SHOWMINIMIZED
Exec $R1
loop:
Sleep 200
FindWindow $R2 "ConsoleWindowClass" "window name"
; NOTE: Make sure it is the same class name in Win9x too
StrCmp $R2"0" 0 loop
Delete $R1
SetDetailsPrint both
DetailPrint "Done!"
If you still don't like it, you can always write your own DLL that creats a new thread which displays some message box and then destroy the thread when the operation is done.

KiCHiK

Create an extension every time I want to prevent a console window from showing up? There has to be a better way.

Brent


If you want it just to hide use my code, if you want a more elegant solution use rainwater's solution.
BTW you won't have to create an extension for every console window, just one that will get the message to display and the command to run using the stack.


I am in a similiar situation, did you ever get the problem solved bmatzelle1? Can anyone tell me how or point me to a place that says how to create the dll like rainwater suggested?


Use nsExec.


I've tried to use nsExec before, but it seems that it gives no indication that the script has been run. Did it display something and I just missed it?


No, it doesn't display anything. That's the whole point - it hides the command window. See Docs\nsExec and Examples\nsExec for more details on what it returns to the script.


Is there a way to display ExecWait's "DOS Box" (console) output in installation details? I know that I can redirect output to file like "hello.exe > hello.txt" and then display that .txt. Any other way? Thank you.


nsExec::ExecToLog.


Yay! :-) Thank you very much!