On Apr 15 16:14, Andy Koppe wrote: > I think I found the reason why consoles pop up for mintty and XWin on > Windows 7. Cygwin's fhandler_console.cc uses a clever trick where it > allocates a console on an invisible custom "window station". I tried > to do the same in the mintty child process, but found that > AllocConsole() no longer cares whether a custom window station has > been selected with SetProcessWindowStation(): the console window is > opened on the default window station anyway. > > Here's what I did, between forkpty() and exec(): > > DWORD version = GetVersion(); > version = ((version & 0xff) << 8) | ((version >> 8) & 0xff); > if (version >= 0x0601) { > HWINSTA wst0 = GetProcessWindowStation(); > HWINSTA wst = CreateWindowStation (NULL, 1, WINSTA_ALL_ACCESS, &sa); > SetProcessWindowStation(wst); > AllocConsole(); > SetProcessWindowStation(wst0); > CloseWindowStation(wst); > } > > Debug output showed that the function calls all succeeded, and that > CreateWindowStation() did create a station separate from the default > one. > > No idea what to do about it ...
Treat it as a bug in Windows 7, probably. Do you get the console window as soon as you call AllocConsole, or does it open later? If so, it could also be the Cygwin code which allocates another console for some reason. If the above code also allocs a console window when run from a non-cygwin (mingw) application, then this should be reported as a bug to Microsoft. As long as W7 is beta, there's a good chance it gets fixed before it will be released. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/