FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper How I do my app to system tray of windows XP
Posts: 31
Joined: Wed Oct 19, 2005 03:30 AM
How I do my app to system tray of windows XP
Posted: Tue Feb 07, 2006 03:58 AM

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

Posts: 48
Joined: Tue Dec 27, 2005 12:40 PM
Put this code in program
Posted: Tue Feb 07, 2006 07:51 AM

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

Continue the discussion