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.
SET OLEOBJECT
, Set(“OLEObject”)This setting determines whether OLE objects can be created and manipulated in the application.
SET OLEOBJECT ON | OFF
cOLEObject = SET( "OLEOBJECT" )
Whenever you create an object in VFP using CREATEOBJECT()
, NewObject()
, or AddObject(), FoxPro searches for a class definition that matches the name of the class you supply. It searches the FoxPro base classes, class definitions already in memory, the current program, the CLASSLIB setting, the PROCEDURE setting, the program stack, and then, finally, the Registry. With OLEOBJECT set ON (the default and the setting we recommend), OLE class definitions in the Registry are included in the search whenever an attempt is made to create an object.
With SET OLEOBJECT
OFF, the Windows Registry is not used as the last item in the search path of the CREATEOBJECT()
, AddObject() or NewObject()
functions, effectively turning off OLE Automation. While this lowers the memory overhead needed to run Visual FoxPro on a workstation, we suspect this overhead isn’t as much of a problem as trying to figure out why OLE Automation doesn’t work.
If a mistyped class definition causes the Registry to be searched, even though the class should have been found within your application, a small bit of time will certainly be consumed with this search. However, we think that given how few times this will occur, the overhead is negligible—you’re about to blow up anyway, right? On the other hand, picture yourself banging your head bloody against the client’s monitor at three in the morning screaming, “But it worked on my machine!” when this setting gets toggled off by some rogue routine at your client’s site. Whether or not you intend to use OLE Automation in your application, we suggest you leave this setting at its default ON setting.
This setting has no effect on general fields, or OLE objects on forms. OLE support is automatically loaded if a general field is detected in a table, or if an OLE object is detected while loading a form.
SET OLEOBJECT ON