creating new window at program startup [OFF-TOPIC]?

Dirk Fieldhouse fieldhouse@acm.org
Wed Apr 5 06:23:00 GMT 2000


On Tue, 4 Apr 2000 13:45:06 -0400,  Chris Faylor <cgf at cygnus dot com>
wrote:

>On Tue, Apr 04, 2000 at 02:41:11AM -0700, Michele Liberi wrote:
>>launching from 'command' or 'cmd' an application created without -mwindows
>>flag involves the creation of a new window.
>>
>>I would like to create the new window only if I need it. How may I control
>>the creation of the new window without generating two versions of the
>>executable?
>
>I'm sorry.  This is off-topic for this mailing list.  Try one of
>the general-purpose windows programming mailing lists or newsgroups.
>You should be able to find information at www.deja.com.

I know Chris is the arbiter of on/off-topicness but I also used to think that it was reasonable to expect that it should be possible to create a Cygwin program such that when launched from a command prompt it uses that window for its standard I/O, or otherwise creates a new window for its standard I/O. It also seemed reasonable that this possibility would depend on the run-time library (eg, the start-up code) and hence Cygwin.

Only after considerable disappointment did it become clear that this is not simply achievable given the Microsoft execution model, apparently for any development environment:

-	if you link for the GUI subsystem (implied by -mwindows), the program can never know about the console from which it was started

-	if you link for the console subsystem, a new console will _always_ be created, whether or not standard I/O is performed.

What may be a reasonable solution is demonstrated by the rxvt port linked from the Cygwin page, where (IIRC) a hidden console (eg for bash) is mirrored in a visible GUI window.

/df

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list