Funktionreferenz


_WinAPI_PickIconDlg


Displays a dialog box that allows the user to choose an icon

#include <WinAPIDlg.au3>
_WinAPI_PickIconDlg ( [$sIcon = '' [, $iIndex = 0 [, $hParent = 0]]] )

Parameter

$sIcon [optional] The fully-qualified path of the file that contains the initial icon.
$iIndex [optional] The index of the initial icon. Default is 0.
$hParent [optional] Handle of the parent window.

Rückgabewert

Success: The array containing the following information:
[0] - The path of the file that contains the selected icon.
[1] - The index of the selected icon.
Failure: Sets the @error flag to non-zero.

Bemerkungen

This function also sets the @error flag to 1 if the icon was not selected.

Siehe auch

Suche nach PickIconDlg in der MSDN Bibliothek.

Beispiel

#include <GUIConstantsEx.au3>
#include <WinAPIDlg.au3>

Local $aLast[2] = [@SystemDir & '\shell32.dll', 3]

Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 160, 160)
Local $idButton = GUICtrlCreateButton('Icon ändern...', 25, 130, 110, 23)
Local $idIcon = GUICtrlCreateIcon($aLast[0], -(1 + $aLast[1]), 64, 54, 32, 32)
GUISetState(@SW_SHOW)

Local $aData
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $idButton
            $aData = _WinAPI_PickIconDlg($aLast[0], $aLast[1], $hForm)
            If IsArray($aData) Then
                GUICtrlSetImage($idIcon, $aData[0], -(1 + $aData[1]))
                $aLast = $aData
            EndIf
    EndSwitch
WEnd