Archive: Flashing Command Window


Flashing Command Window
Hi

When my installer starts I run an executable and that executable flashes up a command window. In addition, when I uninstall the same problems occurs on the same executable.

This flashing does not affect the installation or whilst I am uninstalling. However, it will be a nuisance to users.

I have trawled the forum and found the ExecDos plug-in. Will this stop the flashing or is there anything I can use in NSIS that will alleviate this problem.

Cheers,

Paul


ExecDos is ok, just try it.
Also the included nsExec plugin.


Hi

I am using ExecDos plug-in to prevent the command window from appearing whilst running an executable. Whilst installing this works perfectly, on my uninstall I need to wait before I commence. How is this done?

The old way I was using the command:

ExecWait "$INSTDIR\Service\someExecutable.exe u"

Using ExecDocs I am using the command:

ExecDos::exec /DETAILED /TIMEOUT=6000 "Service\someExecutable.exe /u"
Pop $0 ; thread handle for 'wait'
time to check process exit code (optional)
ExecDos::wait $0


The problem is that there is no waiting.

Any ideas?

Cheers,

Paul

I have just increased the TIMEOUT=8000 and that did the trick.


Don't use a time-out. That will just ensure your process is killed before it finishes its job.

Stu


OK, thanks for that. I have omitted the TIMEOUT as requested. However, I do not beleive that we waiting for the processto finish.

Here is my code:


DetailPrint "Removing Service..."
ExecDos::exec /DETAILED "$INSTDIR\Service\someExecutable.exe /u"
Pop $0 ; thread handle for 'wait'
ExecDos::wait $0


Do you know what is wrong?

Cheers,

Paul

You are not using it correctly. The wait function is only used when you specify /ASYNC.

You do not need to use ExecDos::wait with it omitted.

Stu


I am using the following code:


DetailPrint "Removing Service..."
ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$INSTDIR\Service\${PHONE_SERVICE} /u"
Pop $0 ; thread handle for 'wait'
ExecDos::wait $0


In the docs is says:

ASYNC
Not waits for process exit. Use 'wait' call if you want to get exit code. (/NOUNLOAD is mandatory!)

So I've included the /NOUNLOAD. The problem still exists as we are not waiting.

Any further ideas?

Paul

Perhaps it is not actually executing the program?
Try:

ExecDos::exec /NOUNLOAD /ASYNC /DETAILED `"$INSTDIR\Service\${PHONE_SERVICE}" /u`


Stu

On install the program installs itself into Windows Services, during uninstall the program uninstalls itself from Window services. It's definitely executing the program because after uninstall there is no program to view in Services.

I have tried the line of code you have just given but to no avail.

Any other ideas?

Paul


If it's executing then how do you know it's not waiting? Does the program take more than a few milliseconds to execute?

Stu


The executable gets deleted but it uses some DLL's that are being left behind despite being recursively deleted. The deletion occurs after the service has finished uninstalling.


To uninstall the program takes apprx 3000-4000 milliseconds.


Stu

I have found the problem now. Thank you very much for your help. I appreciate it a lot.

Regards;

Paul


Can we ask what the solution is? Others who may run into the same problem will like to know how to fix it...

Don


Sorry for the late reply,

The problem was with the DLL's I think. I got given a new versions so I swapped them over with the old ones and it seemed to resolve the problem.

However, The problem has come back, only this time I can't delete the executable but the DLL's have gone. Trust me this is driving me nuts.

If I use the following line of code then all works well, e.g. the executable gets deleted and the uninstaller cleans up.

ExecWait `"$INSTDIR\Service\${PHONE_SERVICE}" /u`


However, I get the horrible flashing of the command window.

If I use the following line instead:

ExecDos::exec /NOUNLOAD /ASYNC /DETAILED `"$INSTDIR\Service\${PHONE_SERVICE}" /u`


Then the executable does not get deleted, but there is no horrible flashing.

Also from the command line if you type:

start /?


It says you can start a new application without starting a new window, so the command would look some thing like:

start /B someProg.exe


Then the application would have no flashing window, cool a?
The problem is that I can't get it to work using

ExecWait `"start /B $INSTDIR\Service\${PHONE_SERVICE}" /u`


Any further help would be appreciated.

Cheers,

Paul

Heres a fragment from my uninstaller:


Section "Uninstall"

....

DetailPrint "Removing Service..."
ExecWait `"$INSTDIR\Service\${PHONE_SERVICE}" /u`
;ExecDos::exec /NOUNLOAD /ASYNC /DETAILED `"$INSTDIR\Service\${PHONE_SERVICE}" /u`

....


; Recursively delete the contents of the following directories
; and finally delete the directory.
RMDIR /r "$INSTDIR\bin\"
RMDIR /r "$INSTDIR\Client"
RMDIR /r "$INSTDIR\JRE_v6"
RMDIR /r "$INSTDIR\Motorola"
RMDIR /r "$INSTDIR\Service"
RMDIR /r "$INSTDIR\Static"

; Remove the installation directory.
RMDir "$INSTDIR"

SectionEnd

I don't think that ExecDoc works for me unless I put sleep 3000 on the next line.

Cheers,

Paul


You're using /ASYNC.

Stu