Hi.
How can I show a meter in a tray icon message? Something like MsgTrayMeter(nTotal, nPercent)? Is it possible?
Thanks.
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
#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
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
#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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 18 guests