#include #include #include #include #include $hMainGUI = GUICreate ("Example", 300, 300) GUISetBkColor (0xFFFFFF, $hMainGUI) GUISetState (@SW_SHOW, $hMainGUI) $iIconCount = _WinAPI_ExtractIconEx ("shell32.dll", -1, 0, 0, 0) $tResIcons = DllStructCreate ("HANDLE[" & $iIconCount & "]") $pResIcons = DllStructGetPtr ($tResIcons) $iIconCount = _WinAPI_ExtractIconEx ("shell32.dll", 0, $pResIcons, 0, $iIconCount) $idButton = GUICtrlCreateButton ("", 50, 50, 45, 45, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll", 16781) $idIcon = GUICtrlCreateIcon ("shell32.dll", 2, 50, 170, 45, 45) GUICtrlSetImage (-1, "shell32.dll", 16780) Sleep (1000) ; This works. GUICtrlSendMsg ($idButton, $BM_SETIMAGE, $IMAGE_ICON, DllStructGetData ($tResIcons, 1, 297)) GUICtrlCreateLabel ("This works.", 50, 100) Sleep (1000) ; Does not work. GUICtrlSendMsg ($idIcon, $BM_SETIMAGE, $IMAGE_ICON, DllStructGetData ($tResIcons, 1, 297)) GUICtrlCreateLabel ("Does not work.", 50, 220) For $i = 1 To $iIconCount _WinAPI_DestroyIcon (DllStructGetData ($tResIcons, 1, $i)) Next While True $nMsg = GUIGetMsg () If $nMsg = $GUI_EVENT_CLOSE Then Exit WEnd