[fpc-pascal] Can a program find out how it was started?

miller at psy.otago.ac.nz miller at psy.otago.ac.nz
Tue Aug 2 12:03:45 CEST 2005

Greetings from New Zealand,

I use fpc to compile programs intended to be run from the command line in a cmd
window (Windows 2000, etc).  Sometimes, though, new users try to start the
programs by double-clicking on the exe file (application icon). When the
program starts, I would like to be able to tell if they have done that,
so that I can present a special error message.

So my question is:
  Is it possible for a program to tell whether it was started from
  the command line or started by double-clicking on the application icon?

I tried checking ParamStr(0) and DOSVersion, but these have the same values
regardless of how the program was started.

Any suggestions?

Thank you for your time,

Jeff Miller

More information about the fpc-pascal mailing list