Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Carlos Alloatti
  Where is Carlos Alloatti?
 
 Vatican City State (Holy See)
 Carlos Alloatti
 To: Andy at Rushcliff
  Where is Andy at Rushcliff?
 Derby
 United Kingdom
 Andy at Rushcliff
 Tags
Subject: RE: Systray Class and missing icon
Thread ID: 189355 Message ID: 189405 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Thursday, August 14, 2008 7:31:33 PM         
   


> Hi All
>
> I have been using the systray class for ages with no problem. I now have a new version of my exe file that uses the systray - when running the exe file from within vfp the icon appears fine. However when running as a stand-alone exe the icon is missing from the system tray.
>
> This is using the standard code in the systray vcx class.
>
> The problem is being caused by a Declare error and seems to be to do with the cTempFileName parameter ...
>
> I have tracked the problem down to the "loadicon" method - the error details are:
> #2027 :Declare DLL call caused an exception.
>
> and the call stack is:
> Line No : 34, Procedure : loadicon (problem appears to be with cTempFileName)
> called from: systray.vct,webform.systray1.addicontoiconlist, Line:8, nHandle = THIS.LoadIcon(m.cIconFileName)
> called from: systray.vct,webform.systray1.iconfile_assign, Line:7, THIS.AddIconToIconList(m.vNewVal)
> called from: remoteserver.sct,webform.init, Line:87, thisform.sysTRAY1.iconfile = "myicon.ico"
>
> The icon file IS in the project (before you ask!)
>
> This is wierd...
> any ideas?
>
> Thanks in advance
> Andy

Try replacing the LoadIcon procedure with this:

LPARAMETERS cIconFileName

Local hImage, loImage

m.loImage = loadpicture(cIconFileName)

Return m.loImage.Handle

Untested

Carlos Alloatti

ENTIRE THREAD

Systray Class and missing icon Posted by Andy at Rushcliff @ 8/14/2008 2:57:16 PM
RE: Systray Class and missing icon Posted by Carlos Alloatti @ 8/14/2008 7:31:33 PM
RE: Systray Class and missing icon Posted by Yousfi Benameur @ 8/15/2008 12:11:29 AM