xterm is a console program?

Karl Waclawek karl@waclawek.net
Fri May 16 19:56:00 GMT 2003


> Case one
> ========
> 1) User double-clicks an X app in Windows Explorer.
> 
> 2) X app opens without causing a command-prompt window to be created.
> 
> 3) Currently, double-clicking an X app will cause a new command-prompt 
> window to be opened that will remain open for the duration that the X 
> app is open.  This is undesired behavior.
> 
> 4) Double-clicked X apps should not open a command-prompt window at all.
> 
> 
> Case two
> ========
> 1) User opens a command prompt window.
> 
> 2) User launches an X app from the command prompt window.
> 
> 3) *CRUCIAL PART*  The X app, being very smart, notices that it was 
> launched from a console window and attaches its text output to that very 
> same console window.  NO NEW CONSOLE IS CREATED.
> 
> 4) Any text error messages (via printf, etc.) from the X app go to the 
> command prompt window that the X app was launched from.

I understand now.
I can do 2) but not 1), since on Windows there is no such concept
as a parent process, so you can't find out which process is your parent
and check if it has a console associated with it. Otherwise you could
simply free your console when the parent didn't have one.

On NT/2000 it might be possible using the NtQueryInformationProcess() API,
which also returns the ID of the "parent" process from which the
process inherited.

Karl



More information about the Cygwin-xfree mailing list