www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Context-aware Win32 GUI exes

reply "Matthew Wilson" <dmd synesis.com.au> writes:
This is a possibly dumb question, but does anyone know of a technique
whereby one can determine whether an executable is launched from the command
line or not. The desired behaviour I am after is outputting the help
information to stdout if launched on the command-line, otherwise popping a
dialog.

Let me tell you that I've tried querying the console characteristics but
that proved to be not wholly reliable, the same goes for getting the
standard handles (via GetStdHandle()).

Matthew
Oct 18 2002
parent "Walter" <walter digitalmars.com> writes:
Try looking at argv[0], and see if there's a difference.

"Matthew Wilson" <dmd synesis.com.au> wrote in message
news:aoptfv$2v26$1 digitaldaemon.com...
 This is a possibly dumb question, but does anyone know of a technique
 whereby one can determine whether an executable is launched from the
command
 line or not. The desired behaviour I am after is outputting the help
 information to stdout if launched on the command-line, otherwise popping a
 dialog.

 Let me tell you that I've tried querying the console characteristics but
 that proved to be not wholly reliable, the same goes for getting the
 standard handles (via GetStdHandle()).

 Matthew
Oct 19 2002