FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem with TrayIcon
Posts: 55
Joined: Thu Mar 13, 2008 02:35 AM

Problem with TrayIcon

Posted: Fri Feb 15, 2019 03:58 AM
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:
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:
   oTray:End()

   oTrayIcon:End()

   oTrayTimer:End()

   oWndTray:End()
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Problem with TrayIcon

Posted: Fri Feb 15, 2019 09:48 AM

Can I see a little PRG sample showing the problem?

EMG

Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM

Re: Problem with TrayIcon

Posted: Sat Feb 16, 2019 01:13 AM

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.

Posts: 55
Joined: Thu Mar 13, 2008 02:35 AM

Re: Problem with TrayIcon

Posted: Sat Feb 16, 2019 06:39 AM

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.

Posts: 99
Joined: Mon Aug 09, 2010 11:00 AM

Re: Problem with TrayIcon

Posted: Mon Sep 09, 2019 12:40 PM
https://prnt.sc/p3rvx7


Hello ich have the same problem

Any news about it ???


Posts: 99
Joined: Mon Aug 09, 2010 11:00 AM

Re: Problem with TrayIcon

Posted: Wed Jul 22, 2020 08:05 AM

Any News about This ???

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: Problem with TrayIcon

Posted: Wed May 28, 2025 07:28 PM

Up -> Just a test to make the identification that was having problems.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Problem with TrayIcon

Posted: Wed May 28, 2025 07:41 PM

We need a sample showing the problem and trying to compile it with latest FWH.

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: Problem with TrayIcon

Posted: Wed May 28, 2025 07:43 PM
Enrico Maria Giordano wrote: 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

// 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 - kapiabafwh@gmail.com
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Problem with TrayIcon

Posted: Wed May 28, 2025 09:34 PM

Your sample works fine here using latest FWH. Please note that you have created two TTrayIcon objects, so you get two tray icons.

Continue the discussion