This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xterm is a console program?


On Thu, May 15, 2003 at 12:22:06PM -0400, Harold L Hunt II wrote:
>>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.

The above is not correct.  Cygwin apps are console apps by default.  There
is some AllocConsole magic coming in 1.5.0 but that's primarily for cygwin
apps that run as a service.

>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.

Windows XP now has a way to do this but that's really not a solution,
obviously.

>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 :)

FWIW, I spent a lot of time searching for a way to do this too.  It was
one of my first tasks at Cygnus.  They wanted me to fix the insight
debugger so that it didn't need a console unless there were errors.  I
never found a good solution, either.

This is one of a few places in the Win32 API where you have to wonder
"What could they possibly have been thinking?"

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]