lxn / walk

A Windows GUI toolkit for the Go Programming Language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notify Icon not loading/working in windows 7

kernelPanic0x opened this issue Β· comments

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 "FULL_PATH/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

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?

commented

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

commented

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

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