|I have used a number of Public declarations in my start program. Sofar i have not found that they were lost. Are you saying that I should use the same method for Public variables ?|
Sent by FoxWeb Support on 11/15/2001 07:58:47 PM:
VFP does stay around in the background, but including your setup code in a single top-level script would not work because:
1. Each channel is a separate instance of VFP, so having the code run once in your top-level script would only run the setup code in a single channel.
2. FoxWeb runs some SET commands before each script:
* SET commands and initialization
SET ANSI OFF
SET PATH TO
SET TALK OFF
SET NOTIFY OFF
SET NEAR OFF
SET EXACT OFF
SET DELETED ON
SET SAFETY OFF
SET ESCAPE OFF
SET EXCLUSIVE OFF
SET MEMOWIDTH TO 1024
SET DEVELOPMENT ON
SET CLOCK OFF
SET CURSOR OFF
SET BELL OFF
SET BLINK OFF
SET ECHO OFF
SET FULLPATH ON
SET SYSFORMATS ON
SET CENTURY ON
SET REPROCESS TO 2 SECONDS
SET DATE AMERICAN
3. Whenever a script error occurs, the channel is restarted.
It is really not a problem to run your SET commands with every request. On my desktop computer I can run the above code over 2 thousand times per second.
Now, if there is other initialization code that you would like to optimize, such as instantiation of COM servers or other variables, you should do so in your FW_ENTER.PRG as follows:
IF TYPE('M.HasInitialized') = 'U'
HasInitialized = .T.
... Add your initalization code here...
The code inside the IF statement will only get run once per channel.
FoxWeb Support Team
Sent by Alan Harris-Reid on 11/15/2001 01:36:40 PM:
I am using Fw_enter.prg program for 'global' environment setting for each script, and it does things like set the SET commands, data path, etc. Once a .fwx script has run, are all the settings lost, or do they 'hang' around until the next .fwx script call (as long as Foxweb is not stopped)? Could I set my environment once in my 'top-level' script (Index.fwx) and have them 'stick-around', or must I regard each .fwx call as a separate VFP session? Must I regard each channel as a separate VFP session? Does VFP stay open in the background while Foxweb is loaded? Would it make any difference if I used the development version of VFP instead of the runtimes?