Voilà l'exemple d'une petite fonction qui permet de changer l'icone de la barre de titre d'une fenêtre d'application non-autoit
Code : Tout sélectionner
#include <WinAPI.au3>
ShellExecute(StringRegExpReplace(@Autoitexe, '(.+)\\[^\\]+', "$1") & "\AutoIt.chm")
Do
Sleep(10)
Until WinExists("AutoIt Help")
$handle = WinGetHandle("AutoIt Help")
; $ico = @scriptdir & "\autoitfr.ico"
; _WinSetIcon($handle, $ico)
_WinSetIcon($handle, "shell32.dll", 137)
WinSetTitle($handle, "", "AutoIt Help with niou icone")
;=========================================
Func _WinSetIcon($hwnd, $file, $index = 0)
Local $tIcons = DllStructCreate("ptr Data")
DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $file, "int", $index, "struct*", 0, "struct*", $tIcons, "uint", 1)
If @error Then Return SetError(1, 0, 0)
Local $hicon = DllStructGetData($tIcons, "Data")
_SendMessage($hwnd, 0x0080, 1, $hicon ) ;$WM_SETICON = 0x0080
_WinAPI_DestroyIcon($hicon)
EndFunc