About building COM and COM+ components
You
can develop a custom class user object containing business logic
in PowerBuilder and then package the object as a COM server or COM+ application.
On platforms that support COM+, such as Windows 2000
and Windows XP, you can build COM+ applications and deploy
them to COM+.
The rest of this chapter uses the term COM components to refer
to components that support COM and COM+.
A PowerBuilder COM application can include one or more PowerBuilder custom
class user objects. You code the user objects in the User Object
painter and then build the server in the Project painter. You can
also deploy the application directly to a local COM+ server
or create a COM+ Microsoft Installer package from the Project
painter.
Once you have generated and deployed a PowerBuilder COM application, users
can call methods on the PowerBuilder objects it contains from COM-enabled
client applications built with tools such as PowerBuilder, Visual Basic,
and C++ compilers.
About using the wizards
PowerBuilder provides several wizards to facilitate the development
and deployment of COM components:
- Target
wizard Creates a new application, a new custom class user object,
and a new project - Object wizard Creates a new custom class user object in an existing application
and creates a new project - Project wizard Creates a project you use to build a COM server and optionally
a COM+ package from one or more existing custom class user objects
When you create a new user object using a COM/COM+ Target
or Object wizard:
- The object has two new events:
Activate and Deactivate. - The object has COM validation support enabled.
- If you checked the box on the last page of the wizard,
the wizard adds items to a To-Do List to remind you to complete
all phases of development.
When to use the wizards
New objects If you plan to build a server containing a single new custom class
user object, use the Target or Object wizard to take advantage of
these features.
If you plan to build a server containing multiple new custom
class user objects, using the Target or Object wizards will give
you a separate project for each object, so you will need to add
all the objects to one of the projects and discard the other projects.
Alternatively, you can create new custom class user objects
without using the Target or Object wizards and then create the project
later using the Project wizard or the Project painter.
You can enable COM validation and add the Activate and Deactivate
events as user-defined events in the User Object painter. For more
information, see “COM validation”.
Existing objects If you have one or more custom class user objects that you want
to deploy as COM servers, make sure that they meet the requirements described
in “Defining the component interface” and
the subsequent sections. As for new user objects, you can enable
COM validation and add the Activate and Deactivate events as user-defined
events in the User Object painter. When you are ready to build the
server, you can use the Project wizard to set up the project.
About the development process
To build and deploy a PowerBuilder COM server from one or more
custom class user objects, you need to complete the following steps:
- Create a new custom class user object or open an
existing user object.
If you use a Target or Object wizard, you also create a project
object that you use to build and deploy the new object. - Code the user object in the User Object painter.
See “Defining the component interface”. - Optionally, create and code additional user objects
in the same application. - If you did not use a wizard to create the user object(s),
create a project using the COM/COM+ Component
Project wizard or the Project painter.
See “Building COM/COM+ components
in the Project painter”. - Open the project, modify the list of selected objects
and their properties if necessary, and build the project. - Deploy the server.
See “Deploying a PowerBuilder COM
server”.