Function Reference


GUISetIcon

Sets the icon used in a GUI window.

GUISetIcon ( iconfile [, iconID [, winhandle]] )

Parameters

iconfile used to display the icon in the title area.
iconID [optional] The ID of the icon in the iconfile. (Default is -1).
winhandle [optional] Windows handle as returned by GUICreate (default is the previously used window).

Return Value

Success: Returns 1.
Failure: Returns 0.

Remarks

Passing a positive number will reference the string equivalent icon name.
Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted

just with negative numbers.

Related

GUICreate

Example


#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\icons\filetype1.ico"
    Local $msg

    GUICreate("My GUI new icon") ; will create a dialog box that when displayed is centered

    GUISetIcon($sFile) ; will change icon

    GUISetState(); will display an empty dialog box

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example