🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10691

Re: Hiding a console app

#10691
From: John Franklin
Date: Thu, 25 Mar 2004 17:12
26 lines
2088 bytes
"Arnie Mauer" <xxx@nowhere.net> wrote in message
news:4062dbdf@newsgroups.borland.com...
> > 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: <40631233@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4062a188@newsgroups.borland.com> <4062dbdf@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-25 09:10:27 PST
From: "John Franklin" <john@lesberries.co.uk>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4062a188@newsgroups.borland.com> <4062dbdf@newsgroups.borland.com>
Subject: Re: Hiding a console app
Date: Thu, 25 Mar 2004 17:12:04 -0000
Lines: 28
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: <40631233@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1080234547 212.103.240.155 (25 Mar 2004 09:09:07 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail