How To Use the Object Property to Reference Methods/Properties

Last reviewed: January 20, 1997
Article ID: Q156548
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows 5.0

SUMMARY

A new Application property has been added to all objects in Visual FoxPro version 5.0. This includes both the OLE Bound control and the OLE Container control. If you have OLE Automation code that does not use the Object property (.object) to reference the various properties and methods of the object, a conflict occurs between the Visual FoxPro Application property and the Application property of the OLE object.

MORE INFORMATION

If you have OLE Automation code in which you have not used the Object property (.object) to reference the properties and methods of the OLE object, then Visual FoxPro 5.0 assumes the references are for the Visual FoxPro Application object properties and methods.

For example, create an OLE object with the following commands:

   PUBLIC frmMyForm
   frmMyForm = CREATEOBJECT("form")
   frmMyForm.AddObject("oleTest","OLEControl","Excel.Chart")

Now enter the following command:

   WAIT WINDOW frmMyForm.oleTest.Application.Name

The message that appears is "Microsoft Visual FoxPro" in Visual FoxPro version 5.0 and "Microsoft Excel" in Visual FoxPro version 3.x.

If you use the following Quit method:

   frmMyForm.oleTest.application.quit

Visual FoxPro version 5.0 calls the Quit method of Visual FoxPro, instead of the Quit method of the OLE object as in Visual FoxPro version 3.x.

In order to reference the properties and methods of the OLE object, you need to update your code to use the Object property as in the following line of code:

   WAIT WINDOW frmMyForm.oleTest.Object.Application.Name

   frmMyForm.oleTest.Object.Application.Quit

REFERENCES

Visual FoxPro 5.0 Help; search on "Application property"

NOTE: This help topic incorrectly lists only Application Object and _VFP System Variable in the applies to list. This property is exposed to all Visual FoxPro base classes.


KBCategory: kbprg kbhowto
KBSubcategory: FxprgClassoop
Additional reference words: 5.00 kbdse VFoxWin APPLICATION OBJECT



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 20, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.