Can a Win32 console application detect if it has been run from the explorer or not?
See http://support.microsoft.com/kb/99115, “INFO: Preventing the Console Window from Disappearing”. The idea is to use GetConsoleScreenBufferInfo to determine that the cursor has not moved from the initial 0,0 position. Code sample from @tomlogic, based on the referenced Knowledge Base article: // call in main() before printing to stdout // returns TRUE if program is in its …