Page 1 of 1
How I do my app to system tray of windows XP
Posted: Tue Feb 07, 2006 3:58 am
by Peter
Dear all,
I'm use FiveWin 2.1c, Comix database, Blinker 7 now. How I run my app. on system tray ?
Best Regrad,
Pe N Chi
Put this code in program
Posted: Tue Feb 07, 2006 7:51 am
by grumpy
Below is the code required to use TTrayIcon if yoy do not have this Class Email me and I will send to you.
// At the top of the Main Program
STATIC oTray
// After the Main function some where before Main Window Activate
oTray := TTrayIcon():New(oWnd,"Mydll.DLL",10,"MyProg"+K_CRLF+'Right Click for Menu',.T.,{||oWnd:Show()},{|nRow,nCol|MenuTray(nRow,nCol,oTray)})
// Then when you Activate the Main Window
ACTIVATE WINDOW oWnd ;
ON INIT (oWnd:bResized := {|| If(oWnd:nRight > 0,(oTray:SetIcon("MyDll.DLL",10),oWnd:Show(),lIsMainIcon := FALSE ),(oTray:SetIcon("MyDll.DLL",10),oWnd:Hide(),lIsMainIcon := TRUE ))},oWnd:iconize() );
VALID ( iif( !lExitPgm ,ExitPgm( TRUE ) ,FALSE ) )
//Place somewhere in Program
FUNCTION MenuTray(nRow,nCol,oTray)
LOCAL ottMenu, oMItem1, oMitem2
MENU ottMenu POPUP
MENUITEM oMItem1 PROMPT "Show MyProg" ACTION(oTray:SetIcon("MyDll.DLL",10),oWnd:Normal(),oWnd:Show(),lIsMainIcon := FALSE ) WHEN lIsMainIcon
SEPARATOR
MENUITEM oMItem2 PROMPT "Hide MyProg" ACTION(oTray:SetIcon("ULTRALOG.DLL",10),oWnd:Hide(),lIsMainIcon := TRUE ) WHEN !lIsMainIcon
ENDMENU
IF lIsMainIcon
ACTIVATE POPUP ottMenu AT nRow-10,nCol+20 OF oTray:oWnd
Else
ACTIVATE POPUP ottMenu AT nRow-55,nCol+60 OF oTray:oWnd
Endif
RETURN NIL