Article View: borland.public.cppbuilder.nativeapi
Article #10698Re: Hiding a console app
From: John Franklin
Date: Fri, 26 Mar 2004 09:13
Date: Fri, 26 Mar 2004 09:13
36 lines
2306 bytes
2306 bytes
Looking at this again, I've found that it _does_ work as required with DETACHED_PROCESS. There was another problem that was masking the effect. Many thanks for everyone's help. John Franklin > > > I need to launch programatically an application that runs as a console > > > application (it's a virus scan program that does some scanning and then > > > closes) but I don't want it to appear on the screen. > > > > > > I have tried setting the STARTUPINFO.wShowWindow in CreateProcess to > > SW_HIDE > > > (or SW_MINIMIZE) but this has no effect. The console window is still > > > displayed. > > > > Try the DETACHED_PROCESS flag in dwCreationFlags in CreateProcess(). > > > That does indeed run the process without a window. However, I don't seem to > be able to track when the process finishes using GetExitCodeProcess, where > hProcess is that returned from CreateProcess in PROCESS_INFORMATION. It > continues to loop with GetExitCodeProcess returning STILL_ACTIVE (which I'm > sure it can't be - the process only takes 20 seconds). > > Actually, it does sometimes work in the debugger if there's a breakpoint > before the first read of GetExitCodeProcess (thus adding some delay). But > that's no good in real life! > > Any other suggestions much appreciated. > > John Franklin > >
Technical Details
Message-ID:
<4063f386$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4062a188@newsgroups.borland.com> <4062dbdf@newsgroups.borland.com> <40631233@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,e0aab47c69c9995e X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-26 01:26:22 PST From: "John Franklin" <john@lesberries.co.uk> Newsgroups: borland.public.cppbuilder.nativeapi References: <4062a188@newsgroups.borland.com> <4062dbdf@newsgroups.borland.com> <40631233@newsgroups.borland.com> Subject: Re: Hiding a console app Date: Fri, 26 Mar 2004 09:13:27 -0000 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 212.103.240.155 Message-ID: <4063f386$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1080292230 212.103.240.155 (26 Mar 2004 01:10:30 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail