[Python-3000] Windows gui vs. console

Phillip J. Eby pje at telecommunity.com
Fri Feb 15 15:34:41 CET 2008


At 02:18 PM 2/15/2008 +0200, Niki Spahiev wrote:
>Phillip J. Eby wrote:
> > That's actually a separate problem from the one Paul and I are
> > talking about, one that I'm not even going to *try* to solve.  (Being
> > as I already have, and failed miserably.)  Hell, I'm not sure Windows
> > even has a way to *tell* whether your app was launched from the
> > command line or otherwise.  I couldn't find one for Win2K, anyway;
> > there might be a way to do it in XP and Vista.
>
>Checking for attached console is one possibility.
>AttachConsole(ATTACH_PARENT_CONSOLE)

That requires XP, but while I was looking it up I ran across an 
article that suggested using both .com and .exe versions of the same 
program, where the .com is a console version, and the .exe is the GUI 
version linked to by any installed shortcuts.  Apparently, you can 
have a .com file whose contents are actually an .exe.



More information about the Python-3000 mailing list