I am looking for 'how to add 'Hide_program_from_Taskbar'
See Example code below :
And I am wondering how/why WindowID(0) and ImageID(0) have the same ObjectID , both zero .
Code: Select all
; Author: PWS32 (updated for PB4.00 by blbltheworm)
If OpenWindow(0, 100, 200, 195, 260, "Test Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
If CreatePopupMenu(0)
MenuItem(1, "Restore Window")
MenuBar()
MenuItem(2, "Quit")
MenuBar()
MenuItem(3, "Help")
EndIf
MessageRequester("Info", "Click to Move Program to SYSTRAY", 0)
HideWindow(0, 1)
LoadImage(0, "HT.ico")
AddSysTrayIcon (1, WindowID(0), ImageID(0)) ; <<--- Take any 16X16 icon here
SysTrayIconToolTip (1, "Right-click for OPTIONS")
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_SysTray ; <<-- PopUp when you right click on your systray icon
If EventType() = #PB_EventType_RightClick
DisplayPopupMenu(0, WindowID(0))
EndIf
EndIf
If EventID = #PB_Event_Menu ; <<-- PopUp Event
Select EventMenu()
Case 1 ; Restore
RemoveSysTrayIcon (1)
HideWindow(0, 0)
MessageRequester("Info", "Press OK and then the Minimize button on the window", 0)
Case 2 ; Quit
Quit = 1
Case 3 ; Help
RunProgram("Hibernate-Help.html")
EndSelect
EndIf
If IsIconic_(WindowID(0)) ;<<-- same With the Minimize button
HideWindow(0, 1)
AddSysTrayIcon (1, WindowID(0), LoadImage(0, "HT.ico"))
SysTrayIconToolTip (1, "Right Mouse Button for PopUp")
EndIf
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf