Reputation: 2317
I've added a handler for the context menu in explorer to show items conditionally. My question is now when it comes time to InvokeCommand
should I use ShellExecute
to run the .exe that needs to run, or should I use the CreateProcess()
method?
Basically the way Windows would do it with static entries is what I'd like to duplicate.
TIA!!
Upvotes: 1
Views: 78
Reputation: 101756
ShellExecute
can do two things CreateProcess
cannot:
CreateProcess
can set some advanced options for the child process that ShellExecute
cannot (handle inheritance, debugging and the attribute list).
If you don't know what you are launching, ShellExecute
is generally preferred. The one thing you have to be careful of is that you don't execute yourself when using ShellExecuteEx
(causing an infinite loop). Not setting the SEE_MASK_INVOKEIDLIST
flag will reduce the risk of this happening. If you know you are launching a .exe then this will not happen...
Upvotes: 1