Article View: borland.public.cppbuilder.nativeapi
Article #12784CreateProcess fails under Win XP
From: Steve Green
Date: Mon, 17 Nov 2003 18:45
Date: Mon, 17 Nov 2003 18:45
56 lines
2635 bytes
2635 bytes
Hi,
I'm just a novice at writing GUI code. I have generated some apps to test various hardware / firmware items that I have designed. Following is a piece of code to launch a sub-program that I use in one of my apps. It has worked fine on various Win 98 machines, but fails to run under WIN XP. It returns the error message in the IF statememt.
What's different with XP?
Thanks,
Steve Green
Sr Engineer
Wabtec Railway Electronics.
*************
char Prog[40] = "C:\\Program Files\\Yamp 2.3\\yamp20.exe ";
*************
STARTUPINFO si;
PROCESS_INFORMATION pi;
//---------------------------------------------------------------
void __fastcall TForm1::Yamp1Click(TObject *Sender)
{
ZeroMemory( &si, sizeof(si) ); //clear info files
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL, //Start the process.
Prog, // Command line.
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si, //Pointer to STARTUPINFO
&pi )) //Pointer to PROCESS_INFORMATION
{
IO_Error = 'G'; //Set Code, program didn't start
}
else
{
WaitForInputIdle( pi.hProcess, INFINITE ); //open
WindowState = wsMinimized;
WaitForSingleObject( pi.hProcess, INFINITE ); //finish
CloseHandle( pi.hProcess ); //Close process / handles.
CloseHandle( pi.hThread );
WindowState = wsNormal;
IO_Error = '0'; //Set Code, OK
}
Display();
}
Technical Details
Message-ID:
<3fb9254a$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!ptdnetS!newsgate.ptd.net!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,9dd22bf10a5b73fb,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-17 11:53:20 PST From: "Steve Green" <sgreen@wabtec.com> Sender: "Steve Green" <sgreen@wabtec.com> Reply-To: "Steve Green" <sgreen@wabtec.com> Subject: CreateProcess fails under Win XP Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 63.107.135.116 NNTP-Posting-Host: 207.105.83.66 Message-ID: <3fb9254a$1@newsgroups.borland.com> Date: 17 Nov 2003 11:45:14 -0700 X-Trace: newsgroups.borland.com 1069098314 207.105.83.66 (17 Nov 2003 11:45:14 -0700) Lines: 57 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!ptdnetS!newsgate.ptd.net!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail