lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.78k stars 886 forks source link

Notify Icon not loading/working in windows 7 #797

Open kernelPanic0x opened 2 years ago

kernelPanic0x commented 2 years ago

Hi.

I'm in the making of a small program with walk. I want to create a balloon icon with notifications only with walk. I am uisng windows 10 to compile and develop. Everything works as expected on windows 10 but as soon as i move to a windows 7 VM to test (target machine for the program) I get an error stating "neither icon resource "assets/icon.ico" nor file "_FULLPATH/assets/icon.ico" could be found or the image format is not supported.

...
mw, err := walk.NewMainWindow()
chkErr(err)

icon, err := walk.Resources.Icon("assets/icon.ico")
chkErr(err)

ni, err := walk.NewNotifyIcon(mw)
chkErr(err)
defer ni.Dispose()

err = ni.SetIcon(icon)
chkErr(err)
...

It crashes on windows 7 on the icon, err := walk.Resources.Icon("assets/icon.ico") line...

Am I doing something wrong or is it a problem of windows 7? My VM is running windows 7 SP1 x64

kernelPanic0x commented 2 years ago

Small update...

I've tested the build binary on windows 11 and it works fine there too. So I assume it is a windows 7 problem?

nyrf commented 2 years ago

I've got same error, do you have solved the problem?

nyrf commented 2 years ago

Update: use go embed and walk.NewIconFromImageForDPI can solve the issue

clarkb7 commented 1 year ago

@lxn I think I found the cause of the issue. see the PR description in https://github.com/DataDog/datadog-agent/pull/15275. Happy to provide more info and help with a fix but not sure how you want to approach it.