2.1.25.72 ShellExecute


Description

Opens or prints a specified file. for more info please check: http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx

Syntax

HINSTANCE ShellExecute( HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int nShowCmd )

Parameters

hwnd
[input] Window handle to a parent window.
lpOperation
[input] Address of a null-terminated string that specifies the operation to perform. The following operation strings are valid: ("open" , "print", "explore" )
lpFile
[input] Address of a null-terminated string that specifies the file to open or print or the folder to open or explore. The function can open an executable file or a document file. The function can print a document file.
lpParameters
[input] If the lpFile parameter specifies an executable file, lpParameters is an address to a null-terminated string that specifies the parameters to be passed to the application. If lpFile specifies a document file, lpParameters should be NULL.
lpDirectory
[input] Address of a null-terminated string that specifies the default directory.
nShowCmd
[input] See the description of the nCmdShow parameter of the ShowWindow function. If lpFile specifies a document file, nShowCmd should be zero.

Return

If the function succeeds, it returns a value greater than 32. If the function fails, it returns an error value that indicates the cause of the failure.

Examples

EX1

void test_ShellExecute()
{

        ShellExecute(NULL, "open", "setup.log", NULL, "C:\\WINDOWS\\", SW_SHOWNORMAL);
}

Remark

See Also

CreateProcess, TerminateProcess , GetExitCodeProcess, WinExec

Header to Included

origin.h

Reference