CreateProcess() Problem
- From: AVee <AVee@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 9 Apr 2008 12:42:07 -0700
Can anyone tell me why this call to CreateProcess() succeeds when the .EXE
extension is used for the application name (in this case "NOTEPAD.EXE"), but
fails with Error 2 (file not found) when the .EXE extension is omitted. (The
docs say that the EXE extension should be appended by CreateProcess() if
omitted). It also fails if I do not provide the full path to the application,
though in this case the path to NOTEPAD is included in the Environment.
DWORD error;
int pret;
STARTUPINFO theStartupInfo;
PROCESS_INFORMATION theProcessInfo;
memset(&theStartupInfo, 0, sizeof(theStartupInfo));
memset(&theProcessInfo, 0, sizeof(theProcessInfo));
GetStartupInfo( &theStartupInfo );
pret = CreateProcess(
_T("C:\\Windows\\NOTEPAD.EXE"),
_T(" C:\\testfile.txt"),
NULL, // Process Attributes NULL default
NULL, // Thread attributes NULL
FALSE, // Don't Inherit handles
CREATE_NEW_CONSOLE, //Creation flags
NULL, // Environment same as calling process
NULL, // Current directory same as calling process
&theStartupInfo, // lp to startup info
&theProcessInfo
);
error = GetLastError();
.
- Follow-Ups:
- Re: CreateProcess() Problem
- From: Joseph M . Newcomer
- Re: CreateProcess() Problem
- From: AliR \(VC++ MVP\)
- Re: CreateProcess() Problem
- Prev by Date: Re: Using ATL classes in an MFC app?
- Next by Date: Re: Multiprocessor crash.
- Previous by thread: Wholesale Patek-4910-10A-011 Cheapest
- Next by thread: Re: CreateProcess() Problem
- Index(es):
Relevant Pages
|