Sorry, I can't reproduce the problem. Here's the code I wrote to create your environment. Please use it and see if you see the same behavior with my code.
CLOSE ALL
CLEAR ALL
ERASE systrayproblem.*
* create form
SET CLASSLIB TO HOME() + "Samples\Solution\Toledo\systray.vcx"
MODIFY FORM systrayproblem NOWAIT
ASELOBJ(aaa,1)
aaa[1].AddObject("systray1", "systray")
aaa[1].systray1.iconfile = HOME() + "Graphics\Icons\Misc\bullseye.ico"
aaa[1].systray1.menutext="1;restore;2;start;3;stop"
* create event code
TEXT TO m.eventcode
LPARAMETERS nMenuItemID
DO CASE
CASE nMenuItemID=1
WITH _screen
.Visible= .T.
.WindowState= 2
ENDWITH
CASE nMenuItemID=2
CASE nMenuItemID=3
CASE nMenuItemID=4
OTHERWISE
WAIT CLEAR
ENDCASE
ENDTEXT
* save event code
aaa[1].systray1.writemethod("processmenuevent", m.eventcode)
*
aaa[1].writemethod("queryunload", "CLEAR EVENTS")
* save scx
KEYBOARD '{CTRL+W}'
DOEVENTS
* create main prg
TEXT TO m.mainprg
SET CLASSLIB TO HOME() + "Samples\Solution\Toledo\systray.vcx"
PUBLIC goScreen
goScreen=CREATEOBJECT('ScrEvents')
BINDEVENT(_screen, "resize", goScreen, "Scrresize")
DO FORM systrayproblem
* minimize to tray
_screen.WindowState = 1
READ EVENTS
DEFINE CLASS ScrEvents AS custom
PROCEDURE scrresize
IF _SCREEN.WindowState = 1
_screen.Visible= .F.
ELSE
_screen.Visible= .T.
ENDIF
ENDPROC
ENDDEFINE
ENDTEXT
* save main prg file
STRTOFILE(m.mainprg, "systrayproblem.prg")
* run main prg file
DO systrayproblem.prg
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts