ShellExecuteΒΆ

ShellExecute opens a file with a program which is registered for the file type.

nErrorCode = ShellExecute(ssFile)
nErrorCode = ShellExecute(ssFile, ssParams)
nErrorCode = ShellExecute(ssFile, ssParams, ssOperation)
nErrorCode = ShellExecute(ssFile, ssParams, ssOperation, ssDir)
nErrorCode = ShellExecute(ssFile, ssParams, ssOperation, ssDir, nShow)

Return Value

If nErrorCode is greater than 32 the function was successfully otherwise an error occurred.

Parameters

ssFile

ssFile is the complete file name.

ssParams

String that specifies the parameters to be passed to the application.

ssOperation

Specifies the action to be performed. Default value ist open. Other Operations: explore, find, print.

ssDir

String that specifies the default (working) directory for the action.

nShow

The flags that specify how an application is to be displayed when it is opened. Possible values: SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED, SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE, SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE, SW_SHOWDEFAULT, SW_FORCEMINIMIZE, SW_MAX. Default value is SW_SHOW.

Example

ShellExecute("d:\\test.xls");

// Opens the Windows Explorer
ShellExecute("c:\\program files");

// Opens notepad
ShellExecute("notepad", "d:\\text.txt");

History

Version Description
R2012.3 (5.40.3) New parameters 2 to 5.

id-329545