Around the vfp systray class

Published on by Yousfi Benameur

Below 5 codes relative to the systray class.

These codes are tested on win8.1

The Systray class is based on the VFP Hyperlink class. This allows the Systray class to be dropped on a form, just like any other visual class or coded as vfp object(createObject, newObject)
.
After adding the Systray class to a form, often the only properties you need to set are:

IconFile – provide the full path and filename for an icon file
TipText – the tip text to display when the mouse is moved over the icon
MenuText – A menu definition string or an MPR filename.
MenuTextIsMPR – Set to .T. if MenuText contains the name of an MPR file.

The default behavior is to add the icon to the system tray when the object is instantiated, and to
display the menu when the icon is clicked with the left or right mouse button.

The systray class

* Displays a balloon tip if the Operating System shell supports it. (shellversion>=5)
* The lnTimeout parameter is the number of SECONDS to display the balloon. This
* timeout period is subject to minimum and maximum values set by the operating
* system (typically 10 and 30 seconds).

* The Icon parameter specifies the icon to display in the
* balloon.  The values are as follows:
*    0 = No icon
*    1 = Info. A lowercase "i" in a small balloon
*    2 = Warning. An exclamation point (!) in a triangle.
*    3 = Error. A red disk with an X through it.
*    Add 16 (0x10) to the value to mute the sound that is played when
*    the balloon is displayed (Windows XP and later).

the text length of the  .ShowBalloonTip is 63 chars (shell version4) and  127 chars (version>=5)
If GetShellVersion() < 5.00   && This shell doesn't support balloon tips.
Below 3 codes realtive to the subject.


*The systray class is located on home(1)+"samples\solution\toledo\systray.vcx"
*it allows to put  codes on contextuel menu in system traybar.
*Contextuels Menus can be inside the code or external as MPR file.
*it can show 4 types of balloons with icons(0,1,2,3).

*Begin code
Clea All

Do ydeclare

**systray must be mandatory in the active folder to work otherwise mandatory must be pointed with "set path to"
*otherwise it returns error in class structure(try/catch/endtry) even if you put the location clas in define class.

Set Path To (Home(1)+"samples\solution\toledo\") 

Publi m.osystray
m.osystray = Createobject("ysystray")


_Screen.AddProperty("myvar","")
TEXT to _screen.myvar noshow
The ShowBalloonTip method accepts four parameters, and only the first is required.
   cBalloonText  - The text to display in the balloon.  To clear a balloon, set to empty string.
   cBalloonTitle - The text to display in the titlebar of the balloon. May be empty string.
   nIcon   - Which standard icon to display next to the text.
   nTimeout  - Time (in seconds) to display the balloon. Subject to OS minimum and maximum values, and user activity.
ENDTEXT

Try
    With m.osystray
        .ShowBalloonTip(_Screen.myvar,"The systray balloon",0,5)
    Endwith
Catch
    Messagebox("Balloon not supported in os version!",16+4096,"error",1000)
Endtry

Read Events

Define Class ysystray As Systray Of "systray.vcx"
    IconFile = Home(1) + "Graphics\Icons\Misc\misc15.ico"
    TipText = "ysystray"
    MenuTextIsMPR = .F.
    MenuText = "1;run explorer ;2; run mspaint;3;run notepad ;4;run any exe ;5; 4 Balloons icons;6;Exit"  &&menu integrated inside code
    
    Procedure ProcessMenuEvent    &&event of systray class
        Lparameters nMenuItemID
        Do Case
            Case nMenuItemID = 0
                * User cleared the menu. Do nothing.
            Case nMenuItemID = 1
                Run/N explorer

            Case nMenuItemID = 2
                Run/N mspaint

            Case nMenuItemID = 3
                Run/N notepad

            Case nMenuItemID = 4
                If ! (shellExecute(0, "open", Getfile('exe'),"","",1)>32)
                    Messagebox("An error was occured!",16+4096,"error",1000)
                Endi

            Case nMenuItemID =5
                With m.osystray

                    For i=0 To 3   &&0 = No icon,1 = Info, 2 = Warning, 3 = Error.
                        
Try
                            .ShowBalloonTip(_Screen.myvar, "balloon Icon :"+Trans(i), i,5)
                        Catch
                            Messagebox("Balloon not supported in os version!",16+4096,"error",1000)
                        Endtry
                        sleep(3000)
                    Endfor

                Endwith
            Case nMenuItemID = 6 && Exit Application
                This.RemoveIconFromSystray()
                Clear Events
        Endcase

    Endproc
Enddefine

Procedure ydeclare
    Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
        STRING cOperation,;
        STRING cFileName,;
        STRING cParameters,;
        STRING cDirectory,;
        INTEGER nShowWindow
    Declare Integer Sleep In kernel32 Integer
Endproc


*End code

 


*2)*This is a standard systray with external contextuel menu MPR

*Begin Code
Clea All
Publi m.yrep
m.yrep=Addbs(Justpath(Sys(16,1)))
Set Defa To (yrep)
Set Safe Off
Set Date Long
_Screen.WindowState=1
Do ydeclare

*Create the ymenu.mpr (menu)
Local m.myMPR
TEXT to m.myMPR noshow

DEFINE POPUP raccourci SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF raccourci PROMPT "Run vfp9" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 2 OF raccourci PROMPT "Run explorer" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR ;
    PICTURE  home(1)+"graphics\icons\misc\camera.ico"
DEFINE BAR 3 OF raccourci PROMPT "Run Mspaint" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR ;
    PICTURE home(1)+"graphics\icons\misc\misc15.ico"
DEFINE BAR 4 OF raccourci PROMPT "Run Calculator" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR ;
    PICTURE home(1)+"graphics\icons\misc\volume01.ico"
DEFINE BAR 5 OF raccourci PROMPT "yTime" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 6 OF raccourci PROMPT "Run Notepad" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 7 OF raccourci PROMPT "Horloge Windows" ;

    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 8 OF raccourci PROMPT "Run Wordpad" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 9 OF raccourci PROMPT "Windows recorder" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 10 OF raccourci PROMPT "Snipping Tool Capture" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 11 OF raccourci PROMPT "WMPlayer" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 12 OF raccourci PROMPT "DOS CMD.exe" ;
    FONT "Courier New",8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 13 OF raccourci PROMPT "Exit"
ON SELECTION BAR 1 OF raccourci ;
    DO _4al16sn4n ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 2 OF raccourci run /n explorer &yrep
ON SELECTION BAR 3 OF raccourci run /n mspaint

ON SELECTION BAR 4 OF raccourci run /n calc
ON SELECTION BAR 5 OF raccourci ;
    DO _4al16sn4o ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 6 OF raccourci run/n notepad.exe
ON SELECTION BAR 7 OF raccourci ;
    DO _4al16sn52 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 8 OF raccourci ;
    DO _4al16sn53 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 9 OF raccourci ;
    DO _4al16sn54 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 10 OF raccourci run/n SnippingTool.exe
ON SELECTION BAR 11 OF raccourci ;
    DO _4al16sn55 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 12 OF raccourci run /n cmd.exe
ON SELECTION BAR 13 OF raccourci oSystray.destroy()

ACTIVATE POPUP raccourci
*
PROCEDURE _4al16sn4n

if !ShellExecute(0, "open", home(1)+"vfp9.exe","","",3)>32
messagebox("An error was occured!",16+4096,"Error",1000)
endi

*
PROCEDURE _4al16sn4o
messagebox(ttoc(dateTime()))

*
PROCEDURE _4al16sn52
local oshell
oshell=newObject("shell.application")
oshell.settime()
*
PROCEDURE _4al16sn53

if !shellexecute(0,"open","wordpad.exe","","",1)>32
messagebox("An error  occured",16+4096,"error",1000)
endi

*
PROCEDURE _4al16sn54
if ! shellexecute(0,"open","c:\windows\system32\SoundRecorder.exe","","",1)>32
messagebox("An error  occured",16+4096,"error",1000)
endi

*
PROCEDURE _4al16sn55
if !shellexecute(0,"open","C:\Program Files\Windows Media Player\wmplayer.exe","","",1)>32
messagebox("An error  occured",16+4096,"error",1000)
endi

ENDTEXT
Strtofile(m.myMPR,m.yrep+"ymenu.mpr")


Set Path To Home(1)+"samples\solution\toledo\"
Publi m.osystray
m.osystray = Createobject("ysystray")
m.osystray.AddIconToSystray()
Read Events && Wait for user input.  it supposesmandatory the e command "clea events" is located on contextuel MPR menu
_Screen.WindowState=0
Set Safe On


Procedure ydeclare
    Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
        STRING cOperation,;
        STRING cFileName,;
        STRING cParameters,;
        STRING cDirectory,;
        INTEGER nShowWindow
    Declare Integer Sleep In kernel32 Integer
Endproc

Define Class ysystray As Systray Of "systray.vcx"
    IconFile = Home() + "Graphics\Icons\Misc\misc15.ico"
    TipText = "Taskbar Icon with menu"
    MenuText = "ymenu.mpr"
    MenuTextIsMPR = .T.  && All work should done in the menu code, so  no further code is needed here.


    Procedure IconClickEvent
        DoDefault()  &&execute the ymenu.mpr as definded in menuText
    Endproc

    Procedure IconRightClickEvent  &&code it the same with iconClickEvent() event
        This.IconClickEvent
    Endproc

    Procedure Destroy   && remove icon from systray,Exit Application
        This.RemoveIconFromSystray()
        Clear Events
    Endproc
Enddefine

*End code

 


Around the vfp systray class
Around the vfp systray class

*3)*This code displays a notification balloon on systray if needed.

*Begin Code

Set Path To (Home(1)+"samples\solution\toledo\") 
Declare Integer Sleep In kernel32 Integer
Publi m.osystray
m.osystray = Newobject("systray" , Home(1)+"samples\solution\toledo\systray.vcx")
With osystray
    .IconFile = Home(1) + "Graphics\Icons\Misc\misc15.ico"
    .AddIconToSystray()
Endwith

Local m.stimeout
m.xtimeout=3000  &&want to show notication in time=3 sec

_Screen.AddProperty("myvar","")
TEXT to _screen.myvar noshow
This a notification to the Visual foxpro users.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci.
ENDTEXT
Set Bell To (Addbs(Getenv('windir')))+"MEDIA\notify.WAV"
?? Chr(7)

Try
    With m.osystray
        .ShowBalloonTip(_Screen.myvar,"Theray balloon",1,5)
    Endwith
Catch
    Messagebox("Balloon not supported in os version!",16+4096,"error",1000)
Endtry
Sleep(m.xtimeout)

m.osystray.RemoveIconFromSystray()
m.osystray=Null
Release m.osystray

*End code


Around the vfp systray class

*-4)- How to know the systray  shellVersion

*Begin Code

Set Path To (Home(1)+"samples\solution\toledo\") 
local m.osystray
m.osystray = Newobject("systray" , Home(1)+"samples\solution\toledo\systray.vcx")

messagebox("Shell version="+osystray.getshellVersion())  &&systray native  method

_cliptext=trans(osystray.getshellVersion())   && result in clipboard

osystray=null
release osystray

*End code


*5)*this code uses the same previous and add animated icons on systray
*make some icons (more 2 or three) to be animated with a timer (interval here=250 ms).


*Begin Code
Clea All
Publi m.yrep
m.yrep=Addbs(Justpath(Sys(16,1)))
Set Defa To (yrep)
Set Safe Off
Set Date Long
_Screen.WindowState=1
Do ydeclare

*Create the same ymenu.mpr (menu)
Local m.myMPR
TEXT to m.myMPR noshow
DEFINE POPUP raccourci SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF raccourci PROMPT "Run vfp9" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 2 OF raccourci PROMPT "Run explorer" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
    DEFINE BAR 3 OF raccourci PROMPT "Run Mspaint" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
    DEFINE BAR 4 OF raccourci PROMPT "Run Calculator" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
    DEFINE BAR 5 OF raccourci PROMPT "yTime" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 6 OF raccourci PROMPT "Run Notepad" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 7 OF raccourci PROMPT "Horloge Windows" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 8 OF raccourci PROMPT "Run Wordpad" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 9 OF raccourci PROMPT "Windows recorder" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 10 OF raccourci PROMPT "Snipping Tool Capture" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 11 OF raccourci PROMPT "WMPlayer" ;
    FONT "Courier New", 8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 12 OF raccourci PROMPT "DOS CMD.exe" ;
    FONT "Courier New",8 style "BI"  COLOR G/W*, B/W*,,,,W+/GR
DEFINE BAR 13 OF raccourci PROMPT "Exit"
ON SELECTION BAR 1 OF raccourci ;
    DO _4al16sn4n ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 2 OF raccourci run /n explorer &yrep
ON SELECTION BAR 3 OF raccourci run /n mspaint
ON SELECTION BAR 4 OF raccourci run /n calc
ON SELECTION BAR 5 OF raccourci ;
    DO _4al16sn4o ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 6 OF raccourci run/n notepad.exe
ON SELECTION BAR 7 OF raccourci ;
    DO _4al16sn52 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 8 OF raccourci ;
    DO _4al16sn53 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 9 OF raccourci ;
    DO _4al16sn54 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 10 OF raccourci run/n SnippingTool.exe
ON SELECTION BAR 11 OF raccourci ;
    DO _4al16sn55 ;
    IN LOCFILE("\YSYSTRAY\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 12 OF raccourci run /n cmd.exe
ON SELECTION BAR 13 OF raccourci oSystray.destroy()

ACTIVATE POPUP raccourci
*
PROCEDURE _4al16sn4n

if !ShellExecute(0, "open", home(1)+"vfp9.exe","","",3)>32
messagebox("An error was occured!",16+4096,"Error",1000)
endi
*
PROCEDURE _4al16sn4o
messagebox(ttoc(dateTime()))
*
PROCEDURE _4al16sn52
local oshell
oshell=newObject("shell.application")
oshell.settime()
*
PROCEDURE _4al16sn53
if !shellexecute(0,"open","wordpad.exe","","",1)>32
messagebox("An error  occured",16+4096,"error",1000)
endi
*
PROCEDURE _4al16sn54
if ! shellexecute(0,"open","c:\windows\system32\SoundRecorder.exe","","",1)>32
messagebox("An error  occured",16+4096,"error",1000)
endi
*
PROCEDURE _4al16sn55
if !shellexecute(0,"open","C:\Program Files\Windows Media Player\wmplayer.exe","","",1)>32
messagebox("An error  occured",16+4096,"error",1000)
endi
ENDTEXT
Strtofile(m.myMPR,m.yrep+"ymenu.mpr")


Set Path To Home(1)+"samples\solution\toledo\"
Publi m.osystray
m.osystray = Createobject("ysystray")
With _Screen
    .Newobject("ytimer1","ytimer")
Endwith

*Animated icon son systray
Local lcPathToIcons, nIcons, aIconFiles[1], nCurrentIcon
lcPathToIcons = Home(1)+"graphics\icons\elements\"           &&moon01.ico---moon08.ico make more 3 icons to  animate them
nIcons = Adir(aIconFiles, lcPathToIcons + "moon*.ICO")
If m.nIcons = 0
    Messagebox("No icons in folder '" + lcPathToIcons + "'")
    Return
Endif

Asort(m.aIconFiles)

With m.osystray
    .ClearIconList()
    For nCurrentIcon = 1 To m.nIcons
        .AddIconToIconList(lcPathToIcons + aIconFiles[nCurrentIcon, 1])
    Endfor
    .AddIconToSystray
    _Screen.yTimer1.Enabled = .T.
Endwith


Read Events && Wait for user input.  it supposesmandatory the e command "clea events" is located on contextuel MPR menu
_Screen.WindowState=0
Set Safe On

Procedure ydeclare
    Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
        STRING cOperation,;
        STRING cFileName,;
        STRING cParameters,;
        STRING cDirectory,;
        INTEGER nShowWindow
    Declare Integer Sleep In kernel32 Integer
Endproc

Define Class ysystray As Systray Of  Home(1)+"samples\solution\toledo\systray.vcx"
    IconFile = Home() + "Graphics\Icons\Misc\misc15.ico"
    TipText = "Taskbar Icon with menu"
    MenuText = "ymenu.mpr"
    MenuTextIsMPR = .T.  && All work should done in the menu code, so  no further code is needed here.


    Procedure IconClickEvent
        DoDefault()  &&execute the ymenu.mpr as definded in menuText
    Endproc

    Procedure IconRightClickEvent  &&code it the same with iconClickEvent() event
        This.IconClickEvent
    Endproc

    Procedure Destroy   && remove icon from systray,Exit Application
       _screen.ytimer1.enabled=.f.
        This.RemoveIconFromSystray()
        m.osystray=Null
        Release m.osystray
        Clear Events

    Endproc
Enddefine

Define Class ytimer As Timer
    Interval=250
    Enabled=.F.
    Procedure Timer
        Try
        m.osystray.switchicon()
        Catch
        Endtry

    Endproc
Enddefine

*End code


my remarks on vfp systray class:

1-it does not support big texts on balloon(limited to 127 chars even with recent shell version as 6...).
2-Round rectangles ballloons are not yet implemented also.
3-Does not support unicode texts.
4-custom icons are not implemented.
-all these can be re implemented in  Winapi_Shell_NotifyIcon structure of the class.

DECLARE INTEGER Shell_NotifyIcon IN shell32.dll AS WinAPI_Shell_NotifyIcon ;
    INTEGER dwMessage, ;
    STRING @ PNOTIFYICONDATA

 


Click on code to select [then copy] -click outside to deselect

 *6* created on 06 february 2017 as sytray class illustration.
*this systray works with an MPR menu (created with menu designer and generated)
*the code creates first the mpr menu as ymenu.mpr in source folder.
*this is a simple code showing the date and time from systray.
**systray must be mandatory in the active folder to work otherwise mandatory must be pointed with "set path to"
*otherwise it returns error in class structure(try/catch/endtry) even if you put the location clas in define class.
*can make also an executable with this applications in systray  menu....


Set Defa To Addbs(Justpath(Sys(16,1)))
set safe off
Local m.myvar
TEXT to m.myvar noshow
*YMENU.MPR  clorized contextuel menu

DEFINE POPUP raccourci SHORTCUT RELATIVE FROM MROW(),MCOL()  COLOR G/W*, B/GR*,,,,W+/GR
DEFINE BAR 1 OF raccourci PROMPT "date Time"
DEFINE BAR 2 OF raccourci PROMPT "Calendar"
DEFINE BAR 3 OF raccourci PROMPT "Exit"
ON SELECTION BAR 1 OF raccourci ;
	DO _4uc12mu1v
ON SELECTION BAR 2 OF raccourci ;
	DO _4uc12mu20
ON SELECTION BAR 3 OF raccourci clea event

ACTIVATE POPUP raccourci

*
PROCEDURE _4uc12mu1v
With m.osystray
	.ShowBalloonTip(_Screen.myvar,"The systray balloon",0,5)
Endwith

*
PROCEDURE _4uc12mu20
Publi oform
oform=Newobject("ycalendar")
oform.Show
Read Events
ENDTEXT

Strtofile(m.myvar,"zmenu.mpr")
*******************************



If !_vfp.StartMode=0
	On Shutdown Quit
Endi
Clea All
Set Path To (Home(1)+"samples\solution\toledo\")
Set Date Long

Publi m.osystray
Local m.oo
m.oo=.F.
Try
	m.osystray = Createobject("ysystray")
Catch
	m.oo=.T.
Endtry
If m.oo=.T.
	Messagebox("Systray class is absent...cancelling.. !",16+4096,1000)
	Return
Endi
m.osystray.AddIconToSystray()

_Screen.AddProperty("myvar","")
TEXT to _screen.myvar textmerge noshow
date : <<date()>>
time: <<time()>>
ENDTEXT

Try
	With m.osystray
		.ShowBalloonTip(_Screen.myvar,"The systray balloon",0,5)
	Endwith
Catch
	Messagebox("Balloon not supported in os version!",16+4096,"error",1000)
Endtry

Read Events

Define Class ysystray As Systray Of "systray.vcx"
	IconFile = Home(1) + "Graphics\Icons\Misc\misc15.ico"
	TipText = "yDateTime"
	MenuTextIsMPR = .T.
	MenuText ="zmenu.mpr"  &&menu integrated inside code-can add other win metro apps if available.
Enddefine

*End code

Define Class ycalendar As Form
	BorderStyle = 0
	Height = 176
	Width = 212
	Left=10
	Top=10
	ShowWindow=2
	AutoCenter = .F.
	Caption = "Calendar"
	MaxButton = .F.
	MinButton = .F.
	AlwaysOnTop = .T.
	BackColor = Rgb(0,0,255)
	Name = "Form1"

	Procedure Init
		With This
			.AddObject("Calendar","olecontrol","MSComCtl2.MonthView.2")
			With .calendar
				.Width=.Parent.Width
				.Height=.Parent.Height
				.Left=0
				.Top=0
				.appearance = 1
				.BackColor = 15790320
				.BorderStyle= 0
				.ForeColor = 8388608
				.monthbackcolor =11586303
				.titlebackcolor =11206613
				.trailingForecolor= 16711935
				.Visible=.T.
				Name="calendar"
			Endwith
		Endwith
	Endproc

	Procedure Activate
		Thisform.Width=Thisform.calendar.Width
	Endproc

	Procedure Destroy
		oform=Null
		Release oform

	Endproc

Enddefine
*
*-- EndDefine: ycalendar


To be informed of the latest articles, subscribe:
Comment on this post
A
Hi, thanks for the master help. just curious no way that every time you open the message always on top any app-?
Reply
Y
i guess you speak about the balloon message of systray class.<br /> this is a demo message in balloon.you can modify it or cut it at all.<br /> the goal is to undersatand that systray class can make alerts on systray and in a balloon.<br /> (the native vfp have not implemented the balloon but the rectangular tooltip limited to 8192 octets).