Greetings,
if you start a console-app by double clicking on it, the console window will vanish when the program exits. For some people that's embarrasing. So it would be nice if your program could find out if it was called from the command line interface or by double click and issue an inkey before exit.
f. ex:
.if <doubleclick>
inkey
.endif
exit
Result: program issues inkey ONLY if started by double click. Interesting behaviour of GetCommandLine is following:
it returns "C:\<path>\progname" when the program was started by double-click, and
progname only when started from CLI, so
include \masm32\include\masm32rt.inc
.code
start:
invoke GetCommandLine
mov esi,eax
print eax,13,10
.if byte ptr[esi] == 34
print "Started by double click",13,10
inkey
.else
print "Started from cmd",9
.endif
exit
end start
would do the job.
Any better ideas?
INVOKE GetStartupInfo
should have something in there
you might also try GetConsoleMode - they may be different values at startup (maybe not)
another one is GetConsoleTitle
for CLI, it is "Command Prompt"
if started by explorer, it is the current folder under which the console was opened
one more to try - GetConsoleWindow