Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hiding a Foxpro application on startup
Message
From
04/10/2000 17:55:35
 
 
To
04/10/2000 17:34:04
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00425044
Message ID:
00425057
Views:
13
Hi, guys!

This problem is common for ActiveX controls and other stuff that is not native to VFP. It is related to the sequence (order) of Windows event calls. We solved this problem by very easy way.
First of all, as Mark Alexander said, put 'SCREEN=OFF' in the config.fpw file and include that file into compiled EXE file so it will be used always. By that way VFP screen will never appears even for short moment at startup.
About maximizing VFP screen from tray icon - I used timer. Make following steps:
1. Make special hiden form just as container for events for timer control. Put timer in it and add following code in Timer event:
IF glRunMyFormInMainForFlag = .T. && run some form
  this.Enabled = .F. && disable timer temporarily

  _Screen.Visible = .T.
  _Screen.WindowState = 2
  * run form or something other on main screen
  .........

  glRunMyFormInMainForFlag = .F. && do not run again in next timer event
  this.Enabled = .T.
ENDIF
The timeout for timer (Interval property) - 10 (miliseconds). Be sure, this will not consume Windows resources.
2. In the event of ActiveX control (or methiod called by Tray Icon event) put following:

glRunMyFormInMainForFlag = .T. && set flag to .T. so timer will fire
return

3. Define global variable glRunMyFormInMainForFlag at startup.

You may use another way for glRunMyFormInMainForFlag flag variable, for example, some global object property or whatever you want.
In addition, above can be used to show RightClick shortcut menu called from Tray Icon. We really made it by using special top-level form and shortcut menu in it. Form instantiated by way I already described, but without showing of the VFP default screen.

HTH

>>Hello:
>>
>> I am trying to hide a foxpro application upon startup. I am then using a tray icon to unhide it. The problem is that the form won't hide on startup. I have found an article on MSDN article (Q136185) stating "
>>
>>After a form or formset is hidden, Visual FoxPro activates the last active object. If no objects were active before the formset became active, the main Visual FoxPro window becomes active. Consequently, if you try to hide the main FoxPro window or set its Visible property to false when there were no prior active objects, Visual FoxPro has no place to go. As a result, the Hide method and Visible property for _Screen are disabled.
>>
>>"
>>
>> I have a button that simply sets _screen.visible to .f. and this hides the form. I want the form hidden on startup, though. Is there a way around this? Is this a limitation of Foxpro? Obviously there are other applications that start hidden with just a system tray icon. Is this possible in VFP. I'm using 6.0 btw. Thanks in advance.
>>
>>
>>
>> -Josh
>HI Josh
>I have a simular problem... I am using bbSystray.Fll, are you using the same? I minimize my Foxpro app by using "Thisform.WindowState = 0" However, I cannot Maximize the application when I double click on the icon in the Systray. Hopefully, I was able to help youa bit, and maybe you can help me! hehe
>
>Rick
>
>P.S. Here is the code snippet:
>SET LIBRARY TO(LibraryLoc + "bbsystray.fll")
>IF AddSysTrayIcon(1,"noproblem.ico", ;
> "ATM Checker","THISFORM.WindowState = 0", ;
> "THISFORM.WindowState = 1",.T.)
> THISFORM.WindowState = 1
>ELSE
> THISFORM.WindowState = 0
>ENDIF
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform