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.
GETHOST()
, ISHOSTED()
Use these functions to manipulate the browser supporting your Active Document.
lIsOrIsnt = IsHosted()
oBrowser = GetHost()
Parameter |
Value |
Meaning |
lIsOrIsnt |
.T. |
Current form is hosted within a browser. |
.F. |
Form is not hosted in a browser. |
|
oBrowser |
Null |
No browser object is available. |
Object |
An object reference to the browser is acting as host. |
Use the ISHOSTED()
function to separate the logic that should run when your forms are running as ActiveDocuments from the logic that they should use as stand-alone forms. If running as ActiveDocuments, a call to GetHost returns an object reference to the hosting browser. Using this reference, you can determine the identity of the host, and then manipulate the object model of the host (such as turning off features or changing the navigation model) to properly host your application.
IF IsHosted()
loBrowser = GetHost()
WAIT WINDOW "Hosted by " + loBrowser.Name
ELSE
WAIT WINDOW "Not browsing"
loBrowser = .NULL.
ENDIF