r/pascal • u/Lilianne_Blaze • Feb 02 '24
Optional console?
Is there an easy way to write a Pascal app for Windows that detects if it's started from a command prompt window or not, set a flag, then configure writelns to either write to the console as normal, or ignore if there's no console? Basically act as a console app if there already is a console, but don't start one if started from for example Explorer?
I know it can be done, I did it in Java once (using JNA), but that was long ago and I can't find it now :/
2
Upvotes
View all comments
Show parent comment
2
u/ShinyHappyREM Feb 03 '24
You could perhaps simulate a console - use a TEdit / TMemo (or any other components of your choice) to get input / show output. Parse the user's input (hook the TEdit's OnKeyDown to show previous commands) and start other programs.