[Solved] AddSysTrayIcon and Win 10

Windows specific forum
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

[Solved] AddSysTrayIcon and Win 10

Post by Dude »

SOLVED. I was running Win 10 under VirtualBox, and when I restarted VirtualBox again to re-test due to nco2k's reply, it now suddenly works! That is, the "systrayicon" variable is no longer 0. Weird!

So just a heads-up: if you get "bugs" when testing under a VM, maybe quit and restart the VM to see if the "bug" persists. :evil:

Original report was as follows:

Just tried one of my apps on Win 10 and it fails to add a systray icon. Below is the relevant code which is causing the failure.

As you can see, it's failing because the "systrayicon" variable is always 0, but that only happens on Win 10 -- it's always non-zero on XP and 7 and therefore works on those versions.

So it seems to be a Win 10-specific bug?

Code: Select all

systrayicon=AddSysTrayIcon(0,app,Catch_Img_App)

Debug app ; Non-zero
Debug Catch_Img_App ; Non-zero
Debug systrayicon ; Always 0 on Win 10, but never on XP or 7

If systrayicon=0
  StartFailure() ; App calls this procedure on Win 10, which quits the app.
Else
  SetSystrayTip()
EndIf
Last edited by Dude on Wed Jan 24, 2018 6:13 am, edited 3 times in total.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: AddSysTrayIcon and Win 10

Post by nco2k »

cant confirm. i only tried in a vm, but this works:

Code: Select all

OpenWindow(0, 0, 0, 100, 100, "Test")
CreateImage(0, 32, 32, 32, RGB(255, 0, 0))
Debug AddSysTrayIcon(0, WindowID(0), ImageID(0))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
can you provide more details?

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: AddSysTrayIcon and Win 10

Post by Dude »

First post edited. It was a VirtualBox issue. :x
Post Reply