Jump to content

Icon Selector?


DeeRiee
 Share

Recommended Posts

Little another example:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 263, 181, 211, 202)

$Button1 = GUICtrlCreateButton("Select Icon", 72, 24, 97, 25, 0)

$icon = GUICtrlCreateIcon("", "", 100, 65)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Button1
            $aRet =_PickIconDlg(@SystemDir & "\shell32.dll", 8, WinGetHandle(""))
            If Not @error Then GUICtrlSetImage($icon, $aRet[0], -$aRet[1] - 1)
        case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func _PickIconDlg($sFileName, $nIconIndex=0, $hWnd=0)
    Local $nRet, $aRetArr[2]
   
    $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _
        "hwnd", $hWnd, _
        "wstr", $sFileName, "int", 1000, "int*", $nIconIndex)
   
    If Not $nRet[0] Then Return SetError(1, 0, -1)
   
    $aRetArr[0] = $nRet[2]
    $aRetArr[1] = $nRet[4]
   
    Return $aRetArr
EndFunc

:)

Good Script, Thanks! >_<
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...