Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CreateProcess + ShowWindow

30 views
Skip to first unread message

Surya Kiran

unread,
Aug 3, 2004, 7:48:55 AM8/3/04
to
Hi all,
I've this windows application, from which i'm spawning another
application, using CreateProcess. I want the spawned application to be
on top of window stack. I'm using this.

==============
STARTUPINFO siStartInfo; /* Input values */
memset( &siStartInfo, 0, sizeof(STARTUPINFO) );
siStartInfo.cb = sizeof(STARTUPINFO);
siStartInfo.dwFlags=STARTF_USESHOWWINDOW ;
siStartInfo.ShowWindow = SW_NORMAL ;

if ( FALSE == CreateProcess(
NULL, /* Executable is first token in cmd */
child_path, /* command line */
NULL, /* process security attributes */
NULL, /* primary thread security attributes */
FALSE, /* handles are inherited */
CREATE_NEW_CONSOLE |
CREATE_NEW_PROCESS_GROUP, /* create flags, see
GenerateConsoleCtrlEvent() */
NULL, /* use parent's environment */
NULL, /* use parent's current directory */
&siStartInfo, /* Startup Input argument */
&piProcInfo )) /* Startup Output argument */
{
// do something ...
}

==============

The code is working fine, to some extent. i.e., i call this
CreateProcess lot of times, but for the first 4 times, the spawned
window is coming on top of the window stack, but wierdly, the spawned
window is going to bottom of window stack from 5th time. I've been
banging my head on this problem for the whole of last week, but could
not find any solution. Is this a setting in windows or it has got
something to do with my program. Any clues will be greatly
appreciated.

Thanks in advance,
Surya

0 new messages