How I do my app to system tray of windows XP

How I do my app to system tray of windows XP

Postby Peter » Tue Feb 07, 2006 3: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
Peter
 
Posts: 31
Joined: Wed Oct 19, 2005 3:30 am

Put this code in program

Postby grumpy » Tue Feb 07, 2006 7: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
grumpy
 
Posts: 48
Joined: Tue Dec 27, 2005 12:40 pm
Location: Australia


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 31 guests