显示图标选择对话框.
#Include <WinAPIEx.au3>
_WinAPI_PickIconDlg ( [$sIcon [, $iIndex [, $hParent]]] )
| $sIcon | [可选参数] 图标文件的完整有效路径. |
| $iIndex | [可选参数] 图标索引. |
| $hParent | [可选参数] 父窗句柄. |
| 成功: | 返回以下参数的数组: |
| [0] - 选定图标的文件路径. | |
| [1] - 选定图标的索引. | |
| 失败: | 返回 0,并设置@error标志为非 0 值. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Last[2] = [@SystemDir & '\shell32.dll', 3]
Global $hForm, $Msg, $Button, $Icon, $Data
$hForm = GUICreate('MyGUI', 160, 160)
$Button = GUICtrlCreateButton('Change Icon...', 25, 130, 110, 23)
$Icon = GUICtrlCreateIcon($Last[0], -(1 + $Last[1]), 64, 54, 32, 32)
GUISetState()
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case -3
ExitLoop
Case $Button
$Data = _WinAPI_PickIconDlg($Last[0], $Last[1], $hForm)
If IsArray($Data) Then
GUICtrlSetImage($Icon, $Data[0], -(1 + $Data[1]))
$Last = $Data
EndIf
EndSwitch
WEnd