CreateProcess() Problem

Tech-Archive recommends: Speed Up your PC by fixing your registry



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();

.



Relevant Pages

  • Re: CreateProcess failure
    ... I call CreateProcess with DEBUG flags on another exe and it ... the child proc never shows. ...
    (microsoft.public.vstudio.general)
  • Re: How to launch .exe as seperate program from VC++ ?
    ... but the current program will remain suspended until the .exe ... Supported ways include CreateProcess() and ShellExecutealong with their ... The VERY first message had nothing to do ... CloseHandle(pi.hProcess); ...
    (microsoft.public.vc.language)
  • Process problem
    ... I am developing a application in which i have called CreateProcess() to execute one exe. ... The problem is that while my first exe call waits for some user input,second CreateProcess starts executing second exe which warm boots device leaving first process incomplete. ...
    (microsoft.public.windowsce.embedded.vc)
  • RE: Question Regarding ACLs
    ... I meant that the service is creating the exe file that it's going ... if you just call CreateProcess (and in absence of Software ... That same SID allows creation of folders at the root of the system drive ... I have a windows service running under local service account. ...
    (microsoft.public.platformsdk.security)
  • Re: How to run one .vb file using another .vb file.
    ... Since a .VB file is not an executable you can't use CreateProcess, ... either use ShellExecuteEx which will launch the exe associated with the file ... Peter Foot ... "Vikas" wrote in message ...
    (microsoft.public.pocketpc.developer)