► Afficher le texte
Code : Tout sélectionner
Func _ShowFileProperties($sFile, $sVerb = "properties", $hWnd = 0)
If Not FileExists($sFile) Then Return SetError(1, 0, 0)
Local Const $SEE_MASK_INVOKEIDLIST = 0xC
Local Const $SEE_MASK_NOCLOSEPROCESS = 0x40
Local Const $SEE_MASK_FLAG_NO_UI = 0x400
Local $PropBuff, $FileBuff, $SHELLEXECUTEINFO
$PropBuff = DllStructCreate("char[256]")
DllStructSetData($PropBuff, 1, $sVerb)
$FileBuff = DllStructCreate("char[256]")
DllStructSetData($FileBuff, 1, $sFile)
$SHELLEXECUTEINFO = DllStructCreate("int cbSize;long fMask;hwnd hWnd;ptr lpVerb;ptr lpFile;ptr lpParameters;ptr lpDirectory;" & _
"int nShow;int hInstApp;ptr lpIDList;ptr lpClass;hwnd hkeyClass;int dwHotKey;hwnd hIcon;" & _
"hwnd hProcess")
DllStructSetData($SHELLEXECUTEINFO, "cbSize", DllStructGetSize($SHELLEXECUTEINFO))
DllStructSetData($SHELLEXECUTEINFO, "fMask", BitOR($SEE_MASK_NOCLOSEPROCESS, $SEE_MASK_INVOKEIDLIST, $SEE_MASK_FLAG_NO_UI))
DllStructSetData($SHELLEXECUTEINFO, "hwnd", $hWnd)
DllStructSetData($SHELLEXECUTEINFO, "lpVerb", DllStructGetPtr($PropBuff, 1))
DllStructSetData($SHELLEXECUTEINFO, "lpFile", DllStructGetPtr($FileBuff, 1))
$aRet = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($SHELLEXECUTEINFO))
If $aRet[0] = 0 Then Return SetError(2, 0, 0)
Local $iPrevMode = Opt("WinTitleMatchMode", 2)
Local $iTitle = StringRegExpReplace($sFile, "^.*\\(.*)\..*", "\1")
WinWait($iTitle)
Do
Sleep(10)
Until WinExists($iTitle) = 0
Opt("WinTitleMatchMode", $iPrevMode)
Return $aRet[0]
EndFunc
► Afficher le texte
Code : Tout sélectionner
;===============================================================================
;
; Function Name: _FileDisplayProperties
; Description:: Uses a DLL to call the properties window of a file
; Parameter(s): $a_CallFile = The file to display the properties of
; $a_Wait = 1, wait until the user closes the dialog
; 0, automatically return when it opens
; Requirement(s): Shell32.dll
; Return Value(s): Returns the DLL call value, 1 if it was a success
; Author(s): Alienware (Swift) and LarryDalooza
; Examples(s):
; #Include <File.au3>
; $FilePropReturnValue = _FileDisplayProperties(@ScriptFullPath)
; MsgBox(0, "_FileDisplayProperties return value", "The return value of _FileDisplayProperties is: " & $FilePropReturnValue)
;
;===============================================================================
Func _FileDisplayProperties($sCallFile, $iWait = 1)
If Not FileExists($sCallFile) Then Return SetError(1, 0, 0)
Local $iReturn = DllCall("shell32.dll", "int", _
"SHObjectProperties", "hwnd", 0, "dword", 0x00000002, _
"wstr", $sCallFile, "wstr", 0)
If $iWait = 1 Then
$bOriginalOpt = Opt("WinTitleMatchMode", -2)
WinWaitActive("Properties", "Cancel")
WinWaitClose("Properties", "Cancel")
Opt("WinTitleMatchMode", $bOriginalOpt)
EndIf
Return $iReturn[0]
EndFunc ;==>_FileDisplayProperties
Voili voilou, bonne journée et surtout bon usage.