Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Apr : Test to see if console app was ran from Delphi/"DOS"/Windows
| Subject: | Test to see if console app was ran from Delphi/"DOS"/Windows |
| Posted by: | "Nicholas Ring" (nicholas.ring@nospam.smf.com.au) |
| Date: | 7 Apr 2005 17:28:19 |
Hi All,
What I would like to do is the following. When the console application is
ran from:
* DOS - do not pause when finished, as the command.com will take over and
the DOS window will be still present (note: this would mean that the user
either typed in the command or ran it from a batch file within the DOS
session).
* Explorer - pause at the end of the application so the user can read the
final information before the window disappears (note: this would mean
that the user either double clicked the application (or batch file) or
used the run command).
* Delphi IDE - same as Explorer. This I have managed to do (using the
DebugHook test - if DebugHook <> 0 then {running under Delphi} ).
When I talk about pausing, I mean waiting displaying a message similar to
"Press Enter to continue (exit?)" and waiting for the user to exit.
Another possibility is to modify the DOS session window attributes to not
close after the application has ran. This would mean that:
* Under DOS session, no change from above.
* Under Explorer, gives me what I want. Window will not close.
* Under Delphi, I do not really care as I can handle this differently
anyhow :)
I would prefer the top option (detecting how the application was ran) but
modifying the DOS session window would also do the job.
Anyone know how to do either of these? or if I am in the newsgroup,
please tell me which one I should be in.
Many thanks in advance,
Nick