Thank u so much Eric.You are a good man.
I tried ur idea but i got error like lotempform not an object.ofcourse i got same error when first started
my program also.but it worked when i changed variable (in systray.showmenu())
from lcClassLib = "systray.vcx" to lcClassLib = "src\class\systray.vcx"
from then on it worked but only for sometime.
i fedup up with it so i tried different approach.i tried same approach and same code (suggested systray Double-click example)
it is even worse it works only develop mode but when i make build and try it runtime nothing happens.
when i click on systray icon it does not respond at all.But it works perfectly in develop.
> 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
cheers