Article View: borland.public.cppbuilder.nativeapi
Article #6656Re: Positioning the window opened by ShellExecute()
From: John
Date: Thu, 21 Apr 2005 18:22
Date: Thu, 21 Apr 2005 18:22
60 lines
3206 bytes
3206 bytes
Hi Vladimir!
> In Win32API Help it says:
>
> <quote>
> SW_SHOWDEFAULT Sets the show state based on the SW_ flag
> specified in the STARTUPINFO structure passed to the CreateProcess
> function by the program that started the application. An application
> should call ShowWindow with this flag to set the initial show state of
> its
> main window.
> <quote>
>
> But I do not know how to use that...
>
It is simple when you know how. See for yourself.
DWORD ReturnCode;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
BOOL bProcessOk;
memset( &StartupInfo, 0, sizeof(STARTUPINFO) );
StartupInfo.cb = sizeof( STARTUPINFO );
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
// StartupInfo.wShowWindow = SW_SHOWMINNOACTIVE;
// StartupInfo.wShowWindow = SW_HIDE;
StartupInfo.wShowWindow = SW_SHOWNORMAL;
memset( &ProcessInformation, 0, sizeof(PROCESS_INFORMATION) );
bProcessOk = CreateProcess( (LPCTSTR) NULL, // pointer
to name of executable module
(LPTSTR) szCommand, // pointer
to command line string
(LPSECURITY_ATTRIBUTES) NULL, // pointer
to process security attributes
(LPSECURITY_ATTRIBUTES) NULL, // pointer
to thread security attributes
(BOOL) TRUE, // handle
inheritance flag
(DWORD) CREATE_NEW_CONSOLE |
NORMAL_PRIORITY_CLASS, // creation flags
(LPVOID) NULL, // pointer
to new environment block
(LPCTSTR) NULL, // pointer
to current directory name
(LPSTARTUPINFO) &StartupInfo, // pointer
to STARTUPINFO
(LPPROCESS_INFORMATION) &ProcessInformation )
; // pointer to PROCESS_INFORMATION
if ( !bProcessOk ) {
// Error treatment...
ReturnCode = GetLastError();
}
Technical Details
Message-ID:
<opsplhcdgptqe2av@news.noeatingpuzzlepieces>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!63.218.45.10.MISMATCH!newshosting.com!nx01.iad01.newshosting.com!news.moat.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4267b289@newsgroups.borland.com> <l4pf61d2lil1m87birrtkr4e37h5qlsee9@4ax.com> <4267e96b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1bac591bc979b6c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 21 Apr 2005 14:22:51 -0400 Subject: Re: Positioning the window opened by ShellExecute() Content-Type: text/plain; charset=iso-8859-15; format=flowed Newsgroups: borland.public.cppbuilder.nativeapi References: <4267b289@newsgroups.borland.com> <l4pf61d2lil1m87birrtkr4e37h5qlsee9@4ax.com> <4267e96b@newsgroups.borland.com> From: John <john@nospam> MIME-Version: 1.0 Message-ID: <opsplhcdgptqe2av@news.noeatingpuzzlepieces> User-Agent: Opera7.11/Win32 M2 build 2887 NNTP-Posting-Host: 66.158.145.188 X-Trace: newsgroups.borland.com 1114107808 66.158.145.188 (21 Apr 2005 11:23:28 -0800) Lines: 60 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!63.218.45.10.MISMATCH!newshosting.com!nx01.iad01.newshosting.com!news.moat.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail