AddSysTrayIcon sometimes fails (again)

Post bugreports for the Windows version here
BarryG
Addict
Addict
Posts: 4316
Joined: Thu Apr 18, 2019 8:17 am

AddSysTrayIcon sometimes fails (again)

Post by BarryG »

Original post: viewtopic.php?t=82026 That post is locked, so I can't add to it.

Anyway, had a different user report the same bug today:

Image

Same bug as the one in my other report. The result of "AddSysTrayImage()" is sometimes 0, but usually non-zero. Not using a VM this time. Using Win 11 Pro now. I can't understand what makes it 0 sometimes.

Here's the actual code in my app (pretty much the same as the original report), with parts left out that aren't relevant.

Code: Select all

#trayicon_app = 0
app = OpenWindow(#win_main, ...]
systrayimage = ImageID(CatchImage(#PB_Any,?Img_App_16_Standard))

[...]

systrayicon = AddSysTrayIcon(#trayicon_app, app, systrayimage)
If systrayicon = 0 ; <- What makes this be 0 sometimes?
  StartFailure("Couldn't create new systray icon.")
Else
  SetSysTrayTip()
EndIf

[...]

DataSection
  Img_App_16_Standard: : IncludeBinary "[Assets]\App_16_Standard.ico"
EndDataSection