You can create Automation servers in an application project by creating an OLE public class user-defined class in a program (.prg) file or visual class library (.vcx) file.
For examples of Automation servers, see the Visual FoxPro ..\Samples\Servers directory.
To create an Automation server
-
Create the class in the Class Designer as a Custom class.
-
On the Class menu, click Class Info.
-
In the Class Info dialog box, click OLE Public.
For more information, see How to: Create Classes and Subclasses.
To create an Automation server programmatically
-
Create the class using the DEFINE CLASS command and include the OLEPUBLIC keyword with the AS clause.
For example, the following code in a class definition in a program file creates a custom OLE public class:
В | Copy Code |
---|---|
DEFINE CLASS person AS CUSTOM OLEPUBLIC FirstName = SPACE(30) LastName = SPACE(45) PROCEDURE GetName RETURN THIS.FirstName + " " + THIS.LastName ENDPROC ENDDEFINE |