; ID: 1140 ; Author: gman ; Date: 2004-08-20 13:57:09 ; Title: ggTray system tray DLL ; Description: a tray DLL that relies on the app peeking for events instead of the app responding to event generated by the icon ; !*! this demo is for BlitzPlus only. please use trayexamp_b3d.bb for Blitz3D ; TODO: you will need to place the ggTray.dll and ggTray.decls files in a folder called userlibs under your B+ directory ; TODO: ggTray.dll will need to be in the same directory that your EXE resides in if you compile ; ; TODO: either compile and run the EXE or change cAppDir$ to the hard location of the ICOs. if you choose to compile, be ; sure to put the ggTray.dll in the same directory as your EXE ;Local cAppDir$=SystemProperty("appdir") Local cAppDir$="c:\develop\trayexamp\" Global cIconStop$=cAppDir$+"stop.ico" Global cIconStart$=cAppDir$+"usergrp.ico" ; create a window that never shows... Global trayWnd=CreateWindow("Tray Example",-100,-100,1,17) HideGadget trayWnd If FileType(cIconStop$)<>1 Notify("you must set the icon path",True) Else ; show the initial icon ggTrayCreate(QueryObject(trayWnd,1)) ; set the icon ggTraySetIconFromFile(cIconStop$) ; set the tooltip ggTraySetToolTip("Tray Example Stopped") ; show the icon with the updated text ggTrayShowIcon() ; main loop to handle events Repeat WaitEvent(100) ; check for a right click If ggTrayPeekRightClick()>0 ; check the tooltip to see what status we are currently at If Instr(ggTrayGetToolTip(),"Stopped")>0 ; set the icon and a new tip ggTraySetIconFromFile(cIconStart$) ggTraySetToolTip("Tray Example Started") Else ; set the icon and a new tip ggTraySetIconFromFile(cIconStop$) ggTraySetToolTip("Tray Example Stopped") EndIf ; TODO: show your menu here at the event mousex,mousey Notify("click occurred at: "+ggTrayEventMouseX(ggTrayPeekRightClick())+","+ggTrayEventMouseY(ggTrayPeekRightClick())) ; clear out the events ggTrayClearEvents() EndIf ; check for a left doubleclick If ggTrayPeekLeftDblClick()>0 Exit EndIf Forever ; clean up the tray ggTrayDestroy() EndIf ; free the invisible tray window FreeGadget trayWnd