Share via


How to: Create Automation Servers

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

  1. Create the class in the Class Designer as a Custom class.

  2. On the Class menu, click Class Info.

  3. 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:

DEFINE CLASS person AS CUSTOM OLEPUBLIC
   FirstName = SPACE(30)
   LastName = SPACE(45)

   PROCEDURE GetName
      RETURN THIS.FirstName + " " + THIS.LastName
   ENDPROC
ENDDEFINE

See Also

Tasks

How to: Build Automation Servers

Concepts

Automation Server Programming Notes

Other Resources

Working with Automation Servers