Page 1 of 1

TTrayIcon

Posted: Fri Feb 27, 2026 4:01 pm
by MarcoBoschi

Hi to all,
I have a difference If I compile this program with an old version of FWH (2015) and the actual (december 2025)

Using the most recent version in the task bar appears the icon aof the program and in my opinion it shouldn't.

Using the 2015 version only in the icon tray appears the icon of this program and this is correct!

Can someone explain to me where I'm going wrong?

have a nice weeknd

Code: Select all | Expand

#include "fivewin.ch"

FUNCTION MAIN()

LOCAL oWnd
LOCAL oTimer
LOCAL oTray
LOCAL oIcoMain

#define GCL_HICON -14

DEFINE ICON oIcoMain RESOURCE "TRAYICO"
DEFINE WINDOW oWnd TITLE "Salvaschermo" ICON oIcoMain FROM 1000,1000 TO 1000,1000

oWnd:bRButtonUp = { | nRow, nCol | Menu( oWnd, oTray, nRow, nCol, oTimer ) }

ACTIVATE WINDOW oWnd ON INIT oTray := TTrayIcon( oWnd )


oTray:End()

RETURN NIL


STATIC FUNCTION MENU( oWnd, oTray, nRow, nCol, oTimer )

LOCAL oMenu
LOCAL iMenu
LOCAL oIcon

DEFINE ICON oIcon  FILE "..\icons\fivewin.ICO"

DEFINE FONT oFont NAME GetSysFont() SIZE 0 , -14

MENU oMenu POPUP  FONT oFont 2007

     MENUITEM "First"
     MENUITEM "Second"
     MENUITEM "Close this menu"             ACTION oMenu:end()
     MENUITEM "&Exir from prograci"         ACTION oWnd:End()

ENDMENU

ACTIVATE MENU oMenu OF oTray:oWnd AT nRow, nCol

RETURN NIL



#pragma BEGINDUMP

void GetMonitorInfo(){}
void MonitorFromPoint(){}
void MonitorFromWindow(){}
void SetClassLongPtr(){}
void GetClassLongPtr(){}
void SendInput(){}
void PrintWindow(){}
void GetDCBrushColor(){}
void GetMenuInfo(){}
void SetMenuInfo(){}
void GetMenuBarInfo(){}
void GetComboBoxInfo(){}
void GetListBoxInfo(){}
void GetWindowLongPtr(){}

#pragma ENDDUMP

Re: TTrayIcon

Posted: Sat Feb 28, 2026 9:45 am
by Antonio Linares

Dear Marco,

Instead of doing:

ACTIVATE WINDOW oWnd ON INIT oTray := TTrayIcon( oWnd )

Please try this:

ACTIVATE WINDOW oWnd ON INIT ( oWnd:Hide(), oTray := TTrayIcon( oWnd ) )


Re: TTrayIcon

Posted: Sat Feb 28, 2026 6:53 pm
by Enrico Maria Giordano

Or

Code: Select all | Expand

ACTIVATE WINDOW oWnd ON INIT oTray := TTrayIcon( oWnd ) HIDDEN

Re: TTrayIcon

Posted: Sat Feb 28, 2026 7:23 pm
by karinha

Enrico, in TESTTRAY.PRG, is this code correct? Will it work? Why change something that worked perfectly in previous versions?

Enrico, en TESTTRAY.PRG, ¿es correcto este código? ¿Funcionará? ¿Por qué cambiar algo que funcionaba perfectamente en versiones anteriores?

Code: Select all | Expand

  ACTIVATE WINDOW oWnd ;
     ON INIT oTray := TTrayIcon():New( oWnd, oIcon, "Testing tray ...",;
             { || MsgInfo( "Left CLick" ) },;
             { | nRow, nCol | MenuTray( nRow, nCol, oTray ) } ) ;
     VALID oTray:End() ;
     ON RIGHT CLICK oTray:SetIcon( oIcon1, "Another" ) HIDDEN

Gracias, tks.

Regards, saludos.


Re: TTrayIcon

Posted: Fri Mar 06, 2026 9:15 am
by MarcoBoschi

Ok Many thanks!
This works fine in my pc (windows 10)
ACTIVATE WINDOW oWnd ON INIT oTray := TTrayIcon( oWnd ) HIDDEN // Enrico

Bye