What are the main differences between the two? I'm willing to run only another EXE from my (C++) application. Are there any differences when inheriting environments, security features etc?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
CreateProcess
returns the handle and id for the started process and it's main thread in thePROCESS_INFORMATION
structureThe main difference between
CreateProcess
andShellExecute
is the following:CreateProcess
is more oriented on low level andShellExec
on the high user lever which see the user in explorer.For example using of
CreateProcess
one can use command line which length is more asMAX_PATH
. It has 32,768 characters restriction. You can also useCreateProcess
to start program (if you have enough permissions) on another windows desktop like on the Logon Screen.Another example. You can use
ShellExecute
to start Control Panel or open any program which existed on the computer for editing of JPG filed for example. So you works withShellExecute
close to the corresponding actions in the Windows Explorer.The main difference is in flexibility.
ShellExecute
is easier to use, but doesn't have a lot of flexibility.CreateProcess
is a pain to use, but lets you do anything.Just for example, with
CreateProcess
, you can specify handles (pipes or files) to use for the standard input/output/error streams in the child.ShellExecute
doesn't give you want way to do that.It's probably also worth noting that although
ShellExecute
can be used to start an executable directly, its primary intent is to "execute" document files -- for example, tell it to "execute" a "whatever.html", and it starts up your default web browser and loads the specified HTML file into it. You can do that usingCreateProcess
as well, but to do it, you (normally) start by callingFindExecutable
to find the program associated with the data file in question, then execute that passing your data file as a parameter.