Funktionreferenz


_WinAPI_ShellExecute


Performs an operation on a specified file

#include <WinAPIShellEx.au3>
_WinAPI_ShellExecute ( $sFilePath [, $sArgs = '' [, $sDir = '' [, $sVerb = '' [, $iShow = 1 [, $hParent = 0]]]]] )

Parameter

$sFilePath The string that specifies the file or object on which to execute the specified verb. Note that not all
verbs are supported on all objects. For example, not all document types support the "print" verb.
$sArgs [optional] The string that specifies the parameters to be passed to the application.
$sDir [optional] The string that specifies the working directory for the action.
$sVerb [optional] The string, referred to as a verb, that specifies the action to be performed. The set of available verbs
depends on the particular file or folder. Generally, the actions available from an object's shortcut
menu are available verbs. The following verbs are commonly used:

"edit"
"explore"
"find"
"open"
"edit"
"print"
$iShow [optional] The flags that specify how an application is to be displayed when it is opened ($SW_*).
$hParent [optional] Handle to the owner window used for displaying a UI or error messages.

Rückgabewert

Success: True.
Failure: False, @extended flag may contain an error value that indicates the
cause of the failure. It can be one of the following values (excluding (-1)).
The operating system is out of memory or resources (0)
ERROR_FILE_NOT_FOUND (2)
ERROR_PATH_NOT_FOUND (3)
ERROR_BAD_FORMAT (11)
SE_ERR_*

Bemerkungen

None.

Siehe auch

Suche nach ShellExecute in der MSDN Bibliothek.

Beispiel

#include <MsgBoxConstants.au3>
#include <WinAPIShellEx.au3>

Local $sFile = InputBox('Run', 'Hier den Namen eines Programms, Ordners, Dokuments oder Internetadresse eingeben welcher geladen werden soll', '', '', 368, 152)

If $sFile Then
    _WinAPI_ShellExecute($sFile, '', '', 'open')
    If @error Then
        Local $iError = @error
        Local $iExtended = @extended
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Fehler = ' & $iError, 'Öffnen fehlgeschlagen "' & $sFile & '".' & @CRLF & @CRLF & _WinAPI_GetErrorMessage($iExtended))
    EndIf
EndIf