Archive: How to hide Dos window? Help


How to hide Dos window? Help
Hi,

I am a newbie of NSIS, when using NSIS, I encounter one problem about DOS black window.

After I install all the files, I have to run a window service so that my program can call this window service correctly. I use one function in .nsi file something like as follows:

Function StartService
Execwait "net start myServiceName"
FunctionEnd

However, it will show me a black Dos window, i really don't want the black window shows up! I tried to use .bat (Dos batch file)! Same thing!

Anybody has good suggestions to help me finish my project!

Thank you.


Use nsExec. The usage example can also help.


nsexec is not perfect at all.

i actually work on a specific script wich starts makensis.exe
with nsexec - in most cases it work here, but on another computer
in most cases it fails.

app1 writes a script which is compiled to app2.
the script is fine but it isnt compiled - app2 is missing
or it contains no data to extract.

so i start to examine nsexec and found execdos:
http://nsis.sourceforge.net/ExecDos_plug-in

execdos produces no errors - app2 is created.

so i think nsexec has limitations with a dos box on a actual
windows xp - it doesnt wait.

you know makensis best...

btw i miss parameters for makensisw - are there any?
(need autoclose after execwait).


Care to elaborate, Brummelchen?


huh?

in short again

- app1 -> script for app2
- extract compiler (20 files only)
- compile script app2
- delete compiler

i think nsexec doesnt get that makensis hasnt finished
so parts of the compiler is deleted while makensis is
still working - so failure occurs - no app2.


I need details. nsExec has always worked fine for me. How and where exactly does it fail?


see above pls - no app2 or no data in app2 (exe is fine)

the original script has around 1500 lines now and the created script is fine - no syntax error.

nsexec fails - execdos works


Did you make sure nsExec is the problem? Try adding a message box after nsExec returns and see if makensis has actually finished by then.

I need a way to reproduce this. The script would work best. A minimal version of it, if possible. All 1500 lines if not.


>> Did you make sure nsExec is the problem?

pretty sure - with a messagebox i get no failure ;)
(although the mbox only tells me, that i can grab the outputted
script & exe for review - on the users computer same)

btw the essential part is half of the script - i am not
ready for "include" which m8 make it easier for me.

>> I need a way to reproduce this.

and i need mail P


kichik@users.sf.net


on the way - you can delete the address now.


That's OK, let Spam Assassin handle whoever/whatever uses that. It's all over the web anyway. And even if it wasn't, spambots randomize user names anyway.


nsExec:exec is working fine for me. Thank you for helping me out.


Brummelchen, I still can't reproduce it. I can barely compile it, because of missing files, and then I can't run it because the browse buttons don't work and I can't read the text.

Can you add some more details on the other computer on which it doesn't work? Also, can you have nsExec run "cmd /C makensis ... > some.log" instead of what it has now and paste the log?

One thing I did get from the script is the lack of Pop after nsExec. I don't see any important code after it, so the stack corruption shouldn't matter too much. But you should add it in case you'll add more code there.


thats why i added the compiled win-version ;)

plugins needed: md5, execdos, helpbutton (not really), IO, banner

>> on the other computer on which it doesn't work?

No, its far away. I only can get the script and the exe-file.
script is fine, but exe only contains header or it doesnt exist.
thats all i can barely say.
ok, some more i dont mind cause it is like mine:
windows xp sp2, nod32 (virusscanner) - meets mine ~70%
i have no details about the dos-box (-default.pif)

i only can say that a message box prevents the failure.
after that is the compiler deleted - much time to execute it properly


But the compiled version is using ExecDos and not nsExec. And the missing files I'm talking about are not the plug-ins, although it would have been nicer if they were in the archive. There are other missing files including images, executables and header files.

I see now that the leave function is not the last code in the script after all. So the stack corruption can have an effect after all.


>> But the compiled version is using ExecDos and not nsExec

gna - right :/

>> that the leave function is not the last code in the script after all.

idd - after compiling it returns to the GUI or it quits.
it only has that ONE page - no need to go back/forward.
so that should be no problem - either the stack behaviour itself is buggy :D

too bad we cant meet this time.


There is a problem with the stack because you continue running code after nsExec returns. That code might be affected by the fact the stack doesn't contain what it expects.


hmm, then it is a stack problem - when i put something on the stack
and take it back in the right sequence - there cant be any problem!?


There can be a problem if something puts another thing on the stack between the time you put the original value and between the time you expect to find that value. That's exactly what happens if you don't Pop nsExec's return value.

But that's just a problem. I doesn't have to be the problem. To pinpoint the problem I need more details and/or a way to reproduce this.


"nsExec::Exec" needs a pop?
i only can read that for the 2 other functions...


They all need a Pop. They all return "error", "timeout" or the exit code.


Then update the documentation pls...


How would you make it clearer? The "return value" section doesn't mention anything about being ExecToStack and ExecToLog specific.


it doesnt help me in my case - but the example only contains
the 2 other functions of nsexec and they need pop.
"nsExec::Exec" is not discussed.
and the doc is also poor about a return value.
idd "nsExec::ExecToStack" hast 2 return values - so test.nsi
indicates for me that the first function needs NO additional POP.


Fine, I updated test.nsi to include an example of nsExec::Exec as well. It Pops.


Thank you - this m8 fix my special problem - i'll give it a try.