ShellExecCmdLine

Go to Home Page

Runs the supplied command using ShellExexcuteEx.

Syntax

HRESULT WINAPI ShellExecCmdLine (
    HWND hwnd,
    LPCWSTR pwszCommand,
    LPCWSTR pwszStartDir,
    int nShow,
    LPVOID pUnused,
    DWORD dwSeclFlags
)

Parameters

hwnd
Message box owner window if any are produced by ShellExecuteEx
pwszCommand
The command to run. Can be a URL or anything else accepted by ShellExecute
pwszStartDir
The initial directory for any new process created
nShow
A SW_ value such as SW_SHOW to be passed to ShellExecuteEx
pUnused
Unused
dwSeclFlags
A set of bitflags. This can be zero or a combination of the following:
SECL_NO_UI (0x2)
Don't display error messages if they occur. Adds SEE_MASK_FLAG_NO_UI to ShellExecuteInfo's dwFlags
SECL_LOG_USAGE (0x8)
Keep track of the number of times the application has been launched. Adds SEE_MASK_FLAG_LOG_USAGE to ShellExecuteInfo's dwFlags
SECL_USE_IDLIST (0x10)
Allow IContextMenu verbs instead of registry verbs. Adds SEE_MASK_INVOKEIDLIST to ShellExecuteInfo's dwFlags
SECL_RUNAS (0x40)
Use the RunAs verb with ShellExecuteEx if AssocQueryString(0, ASSOCSTR_COMMAND, pwszCommand, L"RunAs", NULL, &strSize) doesn't fail and strSize is non-zero on return.

Return Value

S_OK on success or HRESULT_FROM_WIN32(GetLastError()) if ShellExecuteEx fails

Remarks

ShellExecuteInfo.dwMask defaults to SEE_MASK_DOENVSUBST | SEE_MASK_NOASYNC before any modification is made according to the value of dwSeclFlags

This function is used to execute the contents of the Run dialog box.

This function is also known as _ShellExecCmdLine@24.