Mail Archives: cygwin-developers/2001/08/22/07:50:02
Hi!
Wednesday, 22 August, 2001 Corinna Vinschen vinschen AT redhat DOT com wrote:
CV> On Wed, Aug 22, 2001 at 12:18:06PM +0400, egor duda wrote:
>> i use this simple program in such cases.
>>
>> #include <windows.h>
>>
>> #define TITLESIZE 1024
>>
>> int
>> main (int argc, char** argv)
>> {
>> HWND console;
>> char old_title [TITLESIZE];
>> char new_title [TITLESIZE];
>> if (!GetConsoleTitle (old_title, TITLESIZE))
>> return 1;
>> sprintf (new_title, "cygwin.hide.%d", GetCurrentProcessId ());
>> SetConsoleTitle (new_title);
>> Sleep (40);
>> console = FindWindow (NULL, new_title);
>> SetConsoleTitle (old_title);
>> ShowWindow (console, SW_HIDE);
>> }
CV> So you don't destroy the window but simply hide it, right?
yes. if i understood Kazuhiro correctly, he was annoyed with the
window showing at his desktop. at least, i was :), that's why i wrote
it.
>> KF> I think inetd and cygrunsrv shouldn't invoke AllocConsole() and
>> KF> the problem with windows popping up should be solved by Egor's
>> KF> ttyfier.
>>
>> ttyfier is designed to run interactive applications. if you want to
>> run, say, 'net start some_service', which creates new console in case
>> it's not available, it's fine. but if you'll run it with redirected
>> output, e.g 'tfy net start some_service >> service.log', you won't see
>> in service.log what you should normally expect.
CV> I don't understand what ttyfier has to do with that problem. Please
CV> enlighten me!
frankly, i don't know if ttyfier can help with the problems Kazuhiro
encountered. ttyfier calls CreateProcess() with separate new console,
and it it creates it with child's console window hidden. so, in case
of Kazuhiro, he can normally run everything either from service or from
normal interactive session -- he won't have unneeded console window
shown up on his desktop.
but my point is that ttyfier was designed for somewhat different
purposes, i.e. for running interactive native apps, and have its own
limitations. So, hiding annoying window from the desktop can be done
with simpler program.
Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19
- Raw text -