CreateProcess in Windows NT

Question:
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?

Answer:
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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a