#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include "_WinAPI_SetWindowTitleIcon.au3"

_GDIPlus_Startup()
Global Const $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Torus.png"

Global $hWnd = GUICreate("Display Windows Title Icon from file by UEZ 2011", -1, -1, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU), $WS_EX_DLGMODALFRAME)
Global $hIcon_New = _WinAPI_SetWindowTitleIcon($sFile, $hWnd)
GUISetState()

While 1
    If GUIGetMsg("") = -3 Then
		_WinAPI_DestroyIcon($hIcon_New)
		_GDIPlus_Shutdown()
		GUIDelete($hWnd)
		ExitLoop
	EndIf
WEnd