Creates an object from a class definition or an Automation-enabled application.
CREATEOBJECT(cClassName [, eParameter1, eParameter2, ...]) |
Parameters
- ClassName
-
Specifies the class or OLE object from which the new object is created. Visual FoxPro searches for the class or OLE object in the following order:
-
Visual FoxPro base classes
-
Classes in the current program
-
Classes in .vcx class libraries opened with SET CLASSLIB
-
Classes in procedure files opened with SET PROCEDURE
-
Classes in the Visual FoxPro program execution chain
-
The OLE registry if SET OLEOBJECT is ON
OLE objects are created using the following syntax for ClassName:
Copy CodeApplicationName.Class
For example, to create a Microsoft Excel worksheet (which supports Automation), you can use the following syntax:
Copy Codex = CREATEOBJECT('Excel.Sheet')When this code is run, Microsoft Excel is started (if not already running), and a new worksheet is created.
A class library can have an alias. To specify an object in a class library with an alias, include the class library alias followed by a period and the object name.
Note that ClassName cannot be the Visual FoxPro OLE Container control base class.
-
- eParameter1, eParameter2, ...
-
These optional parameters are used to pass values to the Init event procedure for the class. The Init event is executed when you issue CREATEOBJECT( ) and allows you to initialize the object.
Microsoft Visual FoxPro 9 SP2 Help file, VFPX Edition v1.08