Meter in tray messages. Is it possible?

Meter in tray messages. Is it possible?

Postby ariston.ap » Sat Apr 02, 2016 4:40 pm

Hi.

How can I show a meter in a tray icon message? Something like MsgTrayMeter(nTotal, nPercent)? Is it possible?

Thanks.
Last edited by ariston.ap on Sat Apr 02, 2016 5:37 pm, edited 1 time in total.
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
FWH1206 / XHB121 / BCC582 / RESOURCE WORKSHOP / XDEVSTUDIO
Please visit: arsoft-ap.com
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
User avatar
ariston.ap
 
Posts: 11
Joined: Mon Jun 29, 2015 8:16 pm
Location: Macapá - AP - Brazil

Re: Meter in tray messages. Is it possible?

Postby cnavarro » Sat Apr 02, 2016 4:43 pm

Please, You can put any image you need?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Meter in tray messages. Is it possible?

Postby ariston.ap » Sat Apr 02, 2016 5:55 pm

At present I um using the functions below to get what I need, but I would like to have a meter more real.

Code: Select all  Expand view

FUNCTION TestMeterTray()
    LOCAL nTotal := 20
    FOR nPos := 1 TO nTotal
        MsgMeterTray(nPos, nTotal, "Enviando clientes...")
        SysWait(0.1)
    NEXT
    MsgMeterTray(nPos, nTotal, "Enviados com êxito")
RETURN NIL
//----------------------------------------------------------------------------\\
FUNCTION MsgMeterTray(_nPos, _nTot, _cTit)
    LOCAL nPorct, cMeter
   nPorct := INT((100/_nTot) * _nPos)
   cMeter := LEFT(REPLICATE("=", nPorct / 5)+REPLICATE("~", 20), 20)
   cMeter := LEFT(cMeter,10)+STRZERO(nPorct,3)+"%"+RIGHT(cMeter,10)
   ShowMsgTray("["+cMeter+"]", _cTit)
RETURN nil
*------------------------------------------------------------------------------*
FUNCTION ShowMsgTray(cMsg, cTit)
   SysRefresh()
   IF cMsg == NIL .OR. cTit == NIL
      c = GetNotifyIconData( oTray:oWnd:hWnd, 1, WM_TASKBAR, oTray:oIcon:hIcon, "", "")
      Shell_NotifyIcon( 1, c )
   ELSE
      c = GetNotifyIconData( oTray:oWnd:hWnd, 1, WM_TASKBAR, oTray:oIcon:hIcon, cMsg, cTit )
      Shell_NotifyIcon( 0, @c )
      Shell_NotifyIcon( 1, c )
   ENDIF
   oTray:Refresh()
RETURN NIL
 


Result obtained:

Image
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
FWH1206 / XHB121 / BCC582 / RESOURCE WORKSHOP / XDEVSTUDIO
Please visit: arsoft-ap.com
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
User avatar
ariston.ap
 
Posts: 11
Joined: Mon Jun 29, 2015 8:16 pm
Location: Macapá - AP - Brazil

Re: Meter in tray messages. Is it possible?

Postby Antonio Linares » Sat Apr 02, 2016 8:50 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Meter in tray messages. Is it possible?

Postby ariston.ap » Sat Apr 02, 2016 9:45 pm

It is a very interesting example, but it is not exactly what I am looking for.
The icon of my aplication does not show on taskbar, but in the tray only (near the watch).
And I need to show the meter in the tray balloon message, with a title, not within the icon.
Is it possible? Is there a function that already does it?
Thanks in advance!
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
FWH1206 / XHB121 / BCC582 / RESOURCE WORKSHOP / XDEVSTUDIO
Please visit: arsoft-ap.com
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
User avatar
ariston.ap
 
Posts: 11
Joined: Mon Jun 29, 2015 8:16 pm
Location: Macapá - AP - Brazil

Re: Meter in tray messages. Is it possible?

Postby Antonio Linares » Sun Apr 03, 2016 8:09 am

I am trying to build your example but I can find how you build oTray

Please provide a complete example to test it here, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Meter in tray messages. Is it possible?

Postby Silvio.Falconi » Sun Apr 03, 2016 2:32 pm

Antonio,
I think this : (click on wnd after you show the window at ttray )
Code: Select all  Expand view


#include "Fivewin.CH"

static oWnd, oTray, oIcon

function TESTIT()

  local oIcon1

  DEFINE ICON oIcon  FILE "c:\work\fwh\icons\fivewin.ICO"
  DEFINE ICON oIcon1 FILE "c:\work\fwh\icons\folder.ico"

  DEFINE WINDOW oWnd TITLE "Icon Tray Class for FiveWin! from Jim Gale" ICON oIcon

  ACTIVATE WINDOW oWnd ;
  ON CLICK TestMeterTray() ;
     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" )

return NIL

function MenuTray( nRow, nCol, oTray )

   local oMenu

   MENU oMenu POPUP
      MENUITEM "Show" ACTION oWnd:Show(), oWnd:SetFocus()
      MENUITEM "Hide" ACTION oWnd:Hide()
      SEPARATOR
      MENUITEM "Close Application" ACTION oWnd:end()
   ENDMENU

   ACTIVATE POPUP oMenu AT nRow, nCol OF oTray:oWnd

return NIL





FUNCTION TestMeterTray()
    LOCAL nTotal := 20
    FOR nPos := 1 TO nTotal
        MsgMeterTray(nPos, nTotal, "Enviando clientes...")
        SysWait(0.1)
    NEXT
    MsgMeterTray(nPos, nTotal, "Enviados com êxito")
RETURN NIL
//----------------------------------------------------------------------------\\
FUNCTION MsgMeterTray(_nPos, _nTot, _cTit)
    LOCAL nPorct, cMeter
   nPorct := INT((100/_nTot) * _nPos)
   cMeter := LEFT(REPLICATE("=", nPorct / 5)+REPLICATE("~", 20), 20)
   cMeter := LEFT(cMeter,10)+STRZERO(nPorct,3)+"%"+RIGHT(cMeter,10)
   ShowMsgTray("["+cMeter+"]", _cTit)
RETURN nil
*------------------------------------------------------------------------------*
FUNCTION ShowMsgTray(cMsg, cTit)
   SysRefresh()
   IF cMsg == NIL .OR. cTit == NIL
      c = GetNotifyIconData( oTray:oWnd:hWnd, 1, WM_TASKBAR, oTray:oIcon:hIcon, "", "")
      Shell_NotifyIcon( 1, c )
   ELSE
      c = GetNotifyIconData( oTray:oWnd:hWnd, 1, WM_TASKBAR, oTray:oIcon:hIcon, cMsg, cTit )
      Shell_NotifyIcon( 0, @c )
      Shell_NotifyIcon( 1, c )
   ENDIF
   oTray:Refresh()
RETURN NIL
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: Meter in tray messages. Is it possible?

Postby ariston.ap » Sun Apr 03, 2016 3:56 pm

Yes, that is excactly how I built the oTray, using testtray.prg from samples.
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
FWH1206 / XHB121 / BCC582 / RESOURCE WORKSHOP / XDEVSTUDIO
Please visit: arsoft-ap.com
[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
User avatar
ariston.ap
 
Posts: 11
Joined: Mon Jun 29, 2015 8:16 pm
Location: Macapá - AP - Brazil

Re: Meter in tray messages. Is it possible?

Postby Antonio Linares » Sun Apr 03, 2016 8:05 pm

Ariston,

I have been able to find the hWnd of the balloon tooltip. The idea is to paint a progress bar on it:

I am able to grab its handle but don't know why I can't paint on it.

(Also on Windows 10 it looks like a toast. I wonder if we can use its Windows class to create them.)

Code: Select all  Expand view
FUNCTION ShowMsgTray(cMsg, cTit)
   local hWnd, hDC
   SysRefresh()
   IF cMsg == NIL .OR. cTit == NIL
      c = GetNotifyIconData( oTray:oWnd:hWnd, 1, WM_TASKBAR, oTray:oIcon:hIcon, "", "")
      Shell_NotifyIcon( 1, c )
   ELSE
      c = GetNotifyIconData( oTray:oWnd:hWnd, 1, WM_TASKBAR, oTray:oIcon:hIcon, cMsg, cTit )
      Shell_NotifyIcon( 0, @c )
      Shell_NotifyIcon( 1, c )
      hWnd = FindWindow( 0, "New notification" )
      MoveWindow( hWnd, 200, 200, 300, 300, .T. )  // We have the right window handle as we can move it!
      // InvertRect( hDC := GetDC( hWnd ), { 20, 10, 300, 200 } )  does not seem to work
      // ReleaseDC( hWnd, hDC )
   ENDIF
   oTray:Refresh()
RETURN NIL
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Meter in tray messages. Is it possible?

Postby Antonio Linares » Sun Apr 03, 2016 8:10 pm

The class name of those notifications is "Windows.UI.Core.CoreWindow"

If we can create a window of such class then we could have standard Windows notifications
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Meter in tray messages. Is it possible?

Postby Antonio Linares » Sun Apr 03, 2016 8:36 pm

It seems as we can not instantiate new windows of such class:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   TNotification():New()

return nil

CLASS TNotification FROM TWindow

   METHOD New()

   METHOD ClassName() INLINE "Windows.UI.Core.CoreWindow"

ENDCLASS

METHOD New() CLASS TNotification

   ::Create()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests