User Function tSystemTray()
Local systemTray
Local nX := 1Local aItems:= {'NoIcon','Information','Warning','Critical'}
Local lVisible := .T.
Private aListCons := GetResArray("*.png")
If Len(aListCons)>0
oDlg := TWindow():New( 10, 10, 200, 200, "Exemplo tSystemTray",,,,,,,,CLR_BLACK,CLR_WHITE,,,,,,,.T. )
systemTray := tSystemTray():New(oDlg , aListCons[nX] )
//Seta o Icone do System Tray
oTButton1 := TButton():New( 002, 002, "Muda Icone",oDlg,{|| if (nX<Len(aListCons),nX++,nX:=1), systemTray:setIcon(aListCons[nX])},40,10,,,.F.,.T.,.F.,,.F.,,,.F. )
oTButton3 := TButton():New( 002, 055, "Visible",oDlg,{|| oTGet1:lVisible := systemTray:lVisible := lVisible := !lVisible},40,10,,,.F.,.T.,.F.,,.F.,,,.F. )
cTGet1 := Space(100)
cTGet2 := 50000
oTGet1 := TGet():New( 022,02,{|u| if(Valtype(u)=="C",cTGet1 := u , cTGet1)},oDlg,050,009,"@!",,0,,,.F.,,.T.,,.F.,,.F.,.F.,,.F.,.F.,,cTGet1,,,, )
oTGet2 := TGet():New( 022,55,{|u| if(Valtype(u)=="N",cTGet2 := u , cTGet2)},oDlg,050,009,"@E 999999",,0,,,.F.,,.T.,,.F.,,.F.,.F.,,.F.,.F.,,/*cTGet2*/,,,, )
cCombo1:= aItems[1]
nItemCombo := 1
oCombo1 := TComboBox():New(042,02,{|u|if(PCount()>0,cCombo1:=u,cCombo1)},aItems,50,20,oDlg,,{|| nItemCombo := aScan(aItems,cCombo1) - 1},,,,.T.,,,,,,,,,'cCombo1')
//Envia mensagem para o System Tray
oTButton2 := TButton():New( 042, 055, "Mensagem",oDlg,{|| systemTray:showMessage("Titulo" , Alltrim(cTGet1) , nItemCombo , cTGet2, {|| Alert("Click")} )},40,10,,,.F.,.T.,.F.,,.F.,,,.F. )
systemTray:cToolTip := "ToolTip"
oTMenu1 := TMenu():New(0,0,0,0,.T.,,oDlg)
oTItem1 := TMenuItem():New(oDlg,'Menu Item 1',,,,{|| Alert('Menu Item 1') },,'AVGLBPAR1',,,,,,,.T.)
oTItem2 := TMenuItem():New(oDlg,'Menu Item 2',,,,{|| Alert('Menu Item 2') },,,,,,,,,.T.)
oTMenu1:Add(oTItem1)
oTMenu1:Add(oTItem2)
//Seta o Menu do System Tray
systemTray:setMenu(oTMenu1)
oDlg:Activate()
EndIf
Return