Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
This system variable and function are related to getting active document applications to run. _RunActiveDoc contains the Active Document launcher program. SYS(4204) controls active document-debugging mode.
cActiveDocLauncher = _RunActiveDoc
_RunActiveDoc = cActiveDocLauncher
Sys( 4204 [, nOnOrOff ] )
Parameter |
Value |
Meaning |
cActiveDocLauncher |
Character |
The name of a program to run to launch active document applications. Defaults to "RunActD.PRG" in the VFP home directory. |
nOnOrOff |
0 |
Turn off debugging mode for active document applications. |
1 or omitted |
Turn on debugging mode for active document applications. |
Because active document applications can run in VFP itself or in a browser, testing and debugging them presents some special problems.
First, the code you need to run an active doc app is different depending on whether you want it to run in a browser, in the VFP runtime, or in the VFP development environment. Rather than force us to figure it all out, the VFP team has provided us with a clever little tool that offers a jumpstart. When you choose Tools | Run Active Document from the menu (in VFP 6 only) or issue DO (_RunActiveDoc), a little dialog appears that lets you choose an active doc application and indicate where it should run.
If you don’t like the application provided, though, you can replace it with one of your own by changing the value of _RunActiveDoc. You can make the change either programmatically or through the File Locations page of the Tools | Options dialog. Press the Set As Default button on that page to save your preference to the Registry, whether you use the dialog to set it or do it programmatically. Otherwise, you’ll have to reset it every time you start VFP.
Take a look at the program Microsoft supplies—there are some interesting routines for reading and writing configuration information to the resource file, as well as a glimpse of how Microsoft localizes its applications.
So much for letting us test our active doc apps. The second problem is debugging them. If your app is running in a browser, how can you use the debugger to see what’s happening? That’s what SYS(4204) is about. When you set it to 1, the debugger can see the app running in the browser and lets you check things out. When SYS(4204) is set to 0, the debugger doesn’t know a thing about your browser-hosted app.
Unlike most of the SYS() functions, SYS(4204) doesn't return either the current or the new value. In fact, there's no way to determine the current value of this setting. You'd think, by now, Microsoft would know that for every setting, there should be an equal and opposite way to find the current setting. |
Incidentally, the way the active doc launcher provides the Browser (Debugging) mode is by turning on SYS(4204). No magic.
_RunActiveDoc = "MyGreatActiveDocLauncher"
SYS(4204,1) && Turn on debugger in browser mode.
DO (_RunActiveDoc)