Article View: borland.public.cppbuilder.nativeapi
Article #12907Re: how to make CreateProcess spawn a Console application wihtout flashing the console window
From: Jonathan Arnold
Date: Thu, 13 Nov 2003 13:46
Date: Thu, 13 Nov 2003 13:46
32 lines
2171 bytes
2171 bytes
Conny H๏ฟฝkansson wrote:
> Hi!
>
> I spawn a console application from CreateProcess call.
> I done this with the SW_HIDE flag set, like below:
>
> STARTUPINFO StartupInfo;
> StartupInfo.wShowWindow = SW_HIDE;
>
Remember that STARTUPINFO, like all structures passed to the
Windows API, should be zero-initialized before you pass them along.
Often, Windows will get confused if there is junk in there. An
easy way to do the initialization for many API structures is:
STARTUPINFO StartupInfo = {sizeof(STARTUPINFO)};
This does two fold duty:
1] Sets the first member of the structure to be the size of the
structure, which is often the case in API structures
2] Zeroes the rest of it. C++ (and C) rules state that for every
member that isn't specifically initialized, if any are all the rest
are set to zero.
--
Jonathan Arnold C/C++/CBuilder Keen Advice:
http://www.keen.com/categories/categorylist_expand.asp?sid=5156620
Comprehensive C++Builder link site:
http://www.buddydog.org/C++Builder/c++builder.html
Technical Details
Message-ID:
<3fb38b43$2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3fb2aa27$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,180122c330f564ba X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-13 05:47:40 PST Date: Thu, 13 Nov 2003 08:46:43 -0500 From: Jonathan Arnold <jdarnold@buddydog.org> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6a) Gecko/20031030 MultiZilla/1.5.0.3l X-Accept-Language: en-us, en, ja MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: how to make CreateProcess spawn a Console application wihtout flashing the console window References: <3fb2aa27$1@newsgroups.borland.com> In-Reply-To: <3fb2aa27$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 66.92.76.225 Message-ID: <3fb38b43$2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1068731203 66.92.76.225 (13 Nov 2003 05:46:43 -0700) Lines: 32 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail