CreateProcess in Windows NT

CreateProcess in Windows NT

I am using CreateProcess to run applications in Windows NT. I cannot start any applications that are located in the directory Program Files. The user properties are set the same for every directory. Is there another way to start the applications?

There is not another way to start the applications that I’d recommend. However, here’s a wrapper function that I use in my own programs:

{Supply a fully qualified path name in ProgramName and any arguments on the command line. As the help file states: "If lpApplicationName is NULL, the first white space-delimited  token of the command line specifies the module name..." In English, the characters before the first space encountered (or if no space is encountered as in a single program call) is interpreted as the EXE to execute. The rest of the string is the argument line.}procedure ExecNewProcess(ProgramName : String);var  StartInfo  : TStartupInfo;  ProcInfo   : TProcessInformation;  CreateOK   : Boolean;begin  { fill with known state }  FillChar(StartInfo,SizeOf(TStartupInfo),#0);  FillChar(ProcInfo,SizeOf(TProcessInformation),#0);  StartInfo.cb := SizeOf(TStartupInfo);  CreateOK := CreateProcess(nil, PChar(ProgramName), nil, nil,False,              CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS,               nil, nil, StartInfo, ProcInfo);  { check to see if successful }  if CreateOK then    //may or may not be needed. Usually wait for child processes    WaitForSingleObject(ProcInfo.hProcess, INFINITE);end;

Compare this code to what you’ve written and see if there are any differences. I use it a lot and it works just fine.

See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist