LIBRARY rexxgui
DO
notifyicondata = "32u, 32u, 32u, 32u, 32u, 32u, str[64]"
FUNCDEF("Shell_NotifyIcon", "32u, 32u, struct NOTIFYICONDATA", 'shell32')
FUNCDEF('LoadImage', '32u, 32u, str, 32u, 32u, 32u, 32u', 'user32')
FUNCDEF("DestroyIcon", "void, 32u", 'user32')
CATCH FAILURE
CONDITION("M")
RETURN
END
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
hicon = loadimage(0, "MyIcon.ico", 1 , 16, 16, 16 )
IF hicon == 0 THEN DO
guisay("Error loading MyIcon.ico")
SIGNAL skip
END
notifyicondata.1 = 88
notifyicondata.2 = guiwindow
notifyicondata.3 = 10
notifyicondata.4 = 1 + 2 + 4
notifyicondata.5 = 50000
notifyicondata.6 = hicon
notifyicondata.7 = "This is my tooltip text."
IF shell_notifyicon(0, notifyicondata) == 0 THEN guisay("Failure setting the icon")
ELSE tray = "Yes"
again:
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
IF EXISTS(tray) THEN DO
notifyicondata.1 = 88
notifyicondata.2 = rxhandle
notifyicondata.3 = 10
shell_notifyicon(2, notifyicondata)
END
IF EXISTS(hicon) THEN destroyicon(hicon)
guidestroywindow()
END
RETURN
wm_extra:
SELECT ARG(3)
WHEN 50000 THEN DO
SELECT ARG(2)
WHEN 513 THEN guiaddctltext("TrayResult", "User clicked upon the icon")
WHEN 514 THEN guiaddctltext("TrayResult", "")
WHEN 515 THEN guiaddctltext("TrayResult", "User double-clicked the icon")
OTHERWISE
END
END
OTHERWISE
END
RETURN "" |