$sFile = @ScriptName _ShellExecuteEx($sFile, "", @ScriptDir, "Properties") $sWinText = StringTrimRight($sFile, 4) WinWait("[CLASS:#32770]", $sWinText) WinWaitClose("[CLASS:#32770]", $sWinText) Func _ShellExecuteEx($sCmd, $Args = "", $sFolder = "", $Verb = "", $rState = @SW_SHOWNORMAL, $hWnd = 0) Local $struINFO = DllStructCreate("long;long;long;ptr;ptr;ptr;ptr;long;long;long;ptr;long;long;long;long") Local $struVerb = DllStructCreate("char[15];char") Local $struPath = DllStructCreate("char[255];char") Local $struArgs = DllStructCreate("char[255];char") Local $struWDir = DllStructCreate("char[255];char") DllStructSetData($struVerb, 1, $Verb) If StringRight($sCmd, 3) = "lnk" Then Local $aShortcutInfo = FileGetShortcut($sCmd) If IsArray($aShortcutInfo) Then DllStructSetData($struPath, 1, $aShortcutInfo[0]) DllStructSetData($struWDir, 1, $aShortcutInfo[1]) DllStructSetData($struArgs, 1, $aShortcutInfo[2]) $rState = $aShortcutInfo[6] Else Return SetError(1, 0, 0) EndIf Else DllStructSetData($struPath, 1, $sCmd) DllStructSetData($struWDir, 1, $sFolder) DllStructSetData($struArgs, 1, $Args) EndIf DllStructSetData($struINFO, 1, DllStructGetSize($struINFO)) DllStructSetData($struINFO, 2, BitOR(0xC, 0x40, 0x400)) DllStructSetData($struINFO, 3, $hWnd) DllStructSetData($struINFO, 4, DllStructGetPtr($struVerb)) DllStructSetData($struINFO, 5, DllStructGetPtr($struPath)) DllStructSetData($struINFO, 6, DllStructGetPtr($struArgs)) DllStructSetData($struINFO, 7, DllStructGetPtr($struWDir)) DllStructSetData($struINFO, 8, $rState) Local $iRet = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($struINFO)) If Not IsArray($iRet) Or Not $iRet[0] Then Return SetError(2, 0, 0) Return 1 EndFunc |