xterm is a console program?

Harold L Hunt II huntharo@msu.edu
Thu May 15 16:22:00 GMT 2003


> Harold,
> 
> Note that nothing prevents non-console programs from calling
> AllocateConsole which would use a console if one is available, or create a
> new one.  However, AFAIU, *all* Cygwin apps are non-console apps!  They
> will call AllocateConsole if necessary, but they would rather use the pty
> if available.
> 	Igor

Igor,

Ah, but if you link with -mwindows you don't get connected to the 
current console.  When you call AllocConsole you create a new console, 
which pops up a new command prompt window, which is precisely what we 
are trying to avoid.  I remember reading somewhere (didn't look for it 
again) that there is no way for a Windows app to attach to the console 
that it was launched from.  I spent quite a bit of time researching 
AllocConsole and other functions when I began using -mwindows for 
XWin.exe.  Every option I explored turned up not to be quite what we 
wanted and I read several articles (some might have been on MSDN, some 
were other places) that said it simply wasn't possible to do something 
like you are suggesting.  Have you demonstration code that implements 
what you are suggesting?  I wrote some demo code at the time that 
convinced me that what I was reading was correct.  However, if you have 
demo code that proves otherwise, I will certainly believe you :)

Additionally, we would have to modify the source code for each of the 
console apps in the XFree86 tree, adding Cygwin-specific code that would 
create a new console for them.  The goal here is to achieve this with 
Imakefile settings, rather than having to maintain code in each of the 
console apps.

Harold



More information about the Cygwin-xfree mailing list