5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-07 04:40:05 +08:00

[windows] Set window icon when in debug mode

This commit is contained in:
Lea Anthony 2024-04-01 04:55:34 +11:00
parent c839c053cb
commit eee373f15a
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -273,6 +273,12 @@ func (w *windowsWebviewWindow) run() {
icon, err := NewIconFromResource(w32.GetModuleHandle(""), uint16(3)) icon, err := NewIconFromResource(w32.GetModuleHandle(""), uint16(3))
if err == nil { if err == nil {
w.setIcon(icon) w.setIcon(icon)
} else {
// Load the icon from the application icon bytes
icon, err = w32.CreateLargeHIconFromImage(globalApplication.options.Icon)
if err == nil {
w.setIcon(icon)
}
} }
} else { } else {
w.disableIcon() w.disableIcon()
@ -862,7 +868,7 @@ func (w *windowsWebviewWindow) setBackdropType(backdropType BackdropType) {
} }
func (w *windowsWebviewWindow) setIcon(icon w32.HICON) { func (w *windowsWebviewWindow) setIcon(icon w32.HICON) {
w32.SendMessage(w.hwnd, w32.BM_SETIMAGE, w32.IMAGE_ICON, icon) w32.SendMessage(w.hwnd, w32.WM_SETICON, w32.ICON_BIG, icon)
} }
func (w *windowsWebviewWindow) disableIcon() { func (w *windowsWebviewWindow) disableIcon() {