Page 1 of 1
Problem with TrayIcon
Posted: Fri Feb 15, 2019 3:58 am
by shark
When exit program loaded in Tray the icon does not disappear.
Program quit but, the icon on Tray, only disappear when I mouse over.
can anyone give me a hint of what to do to remove the Tray icon when I close the program?
I create the icon in Tray da with the class TTrayicon with the following code:
Code: Select all | Expand
oTray := TTrayIcon():New( oWndTray, oTrayIcon, "Sistema Gerenciador" )
oTray:bLButtonUp := { | nRow, nCol | TaskMenu( nRow, nCol - 5 ) }
oTray:bRButtonUp := { | nRow, nCol | TaskMenu( nRow, nCol - 5 ) }
oTray:oNotifyIcon := oTrayIcon
On the quit program execute:
Code: Select all | Expand
oTray:End()
oTrayIcon:End()
oTrayTimer:End()
oWndTray:End()
Re: Problem with TrayIcon
Posted: Fri Feb 15, 2019 9:48 am
by Enrico Maria Giordano
Can I see a little PRG sample showing the problem?
EMG
Re: Problem with TrayIcon
Posted: Sat Feb 16, 2019 1:13 am
by rhlawek
I see this behavior all the time with Windows 10, things like mail showing an icon for new mail, but then not clearing after reading without mousing over the icon. And also left behind in the same way when closing an application, close the app and the icon stays visible until a mouse over. MalwareBytes for example behaves this way. Not at all unique to a fivewin app but it could still be common to whatever is being done, or not done, when closing apps.
Re: Problem with TrayIcon
Posted: Sat Feb 16, 2019 6:39 am
by shark
The problem only occurs when closed in tray through another executable with command:
PostMessage (hCtrl, WM_CLOSE, 2)
When exit program normaly, the icon disappears correctly.
Re: Problem with TrayIcon
Posted: Mon Sep 09, 2019 12:40 pm
by Uwe.Diemer
https://prnt.sc/p3rvx7Hello ich have the same problem
Any news about it ???

Re: Problem with TrayIcon
Posted: Wed Jul 22, 2020 8:05 am
by Uwe.Diemer
Any News about This ???
Re: Problem with TrayIcon
Posted: Wed May 28, 2025 7:28 pm
by karinha
Up -> Just a test to make the identification that was having problems.
Re: Problem with TrayIcon
Posted: Wed May 28, 2025 7:41 pm
by Enrico Maria Giordano
We need a sample showing the problem and trying to compile it with latest FWH.
Re: Problem with TrayIcon
Posted: Wed May 28, 2025 7:43 pm
by karinha
Enrico Maria Giordano wrote: Wed May 28, 2025 7:41 pm
We need a sample showing the problem and trying to compile it with latest FWH.
Just a test to make the identification that was having problems. test: code /code
Code: Select all | Expand
// C:\FWH\SAMPLES\DORNELES.PRG
#Include "FiveWin.ch"
STATIC oWnd, oTray, oIcon, oTmridx, oTmrCheck, oFrame
FUNCTION Main()
LOCAL oImage, oIcon1
DEFINE ICON oIcon FILE "..\icons\fivewin.ico"
DEFINE ICON oIcon1 FILE "..\icons\folder.ico"
DEFINE WINDOW oWnd Title "..:: Robo MD-e Manifestação do Destinatário " ;
ICON oIcon
// + cEmp_Cod + " ::.." //??? Codigo de que Empresa Dorneles?
@ 0, 0 IMAGE oImage SIZE 0, 0 OF oWnd // Quem e oImage?
// E UM DIALOGO? NUNCA VI ISSO NA VIDA.
// O QUE E SKINFRAME, Dorneles? Baytolagem Sao Paulina? kkkkkkkkk
// DEFINE SkinFrame oFrame OF oWnd Skin "", "2", "3" StartPosition 150, 450
// TTrayIconEx() ?? E novo? Ou sua Dorneles? nao entendi isso? para que?
// oTray := TTrayIconEx():New( oWnd, oIcon, oWnd:cTitle ) // Classe Propria?
// Assim funciona.
oTray := TTrayIcon():New( oWnd, oIcon, "Sistema Gerenciador" )
// laskou-se, whats is this?
// oTray : bLDblClick := {| nRow, nCol | MenuTray( nRow, nCol, oTray, oWnd, oTmrIdx ) }
// oWnd:Hide() // Desnecessario a Classe ja faz isso.
// ForeGroundWnd( oWnd:hWnd ) // vixe, o que faz isso? NUNCA VI
// RemoveFromTask( oWnd:hWnd ) // vixe, o que faz isso? NUNCA VI
// A cada 1 minuto
DEFINE TIMER oTmrCheck INTERVAL 60000 ;
ACTION ( UpdateHeartbeat() ) OF oWnd
ACTIVATE TIMER oTmrCheck
// 1 hora
DEFINE TIMER oTmrIdx INTERVAL ( 60000 * 60 ) ;
ACTION ( SysRefresh(), oWnd:Hide(), ;
AUpDateAI( oWnd, oTray, oTmrIdx, 1 ) ) OF oWnd // 6000
ACTIVATE TIMER oTmrIdx
ACTIVATE WINDOW oWnd CENTERED ;
ON INIT oTray := TTrayIcon():New( oWnd, oIcon, "Mensangeria Tray...", ;
{ || MsgInfo( "Left CLick" ) }, ;
{ | nRow, nCol | MenuTray( nRow, nCol, oTray ) } ) ;
VALID( oTray:End() ) ;
ON RIGHT CLICK oTray:SetIcon( oIcon1, "Outra" )
// ON INIT( oWnd:Hide() ) // Desnecessario.
RETURN NIL
FUNCTION UpdateHeartbeat()
? "Donde esta Dorneles? 1" // funciona.
RETURN NIL
FUNCTION AUpDateAI( oWnd, oTray, oTmrIdx, N )
? "Donde esta Dorneles? 2" // Nao esperei
RETURN NIL
FUNCTION MenuTray( nRow, nCol, oTray )
local oMenu
MENU oMenu POPUP
MENUITEM "Show" ACTION oWnd:Show(), oWnd:SetFocus() ;
FILENAME "..\bitmaps\16x16\info.bmp"
MENUITEM "Hide" ACTION oWnd:Hide() ;
FILENAME "..\bitmaps\16x16\faces.bmp"
SEPARATOR
MENUITEM "Close Application" ACTION oWnd:End() ;
FILENAME "..\bitmaps\16x16\Exit.bmp"
ENDMENU
ACTIVATE POPUP oMenu AT nRow, nCol OF oTray:oWnd
RETURN NIL
// FIN / END - [email protected]
Regards, saludos.
Re: Problem with TrayIcon
Posted: Wed May 28, 2025 9:34 pm
by Enrico Maria Giordano
Your sample works fine here using latest FWH. Please note that you have created two TTrayIcon objects, so you get two tray icons.