Automation Object or ASP Object Wizard

From Appmethod Topics
Jump to: navigation, search

Go Up to File Menu

File > New > Other > C++ Projects > ActiveX


File > New > Other > Object Pascal Projects > ActiveX

Use the New Automation Object or ASP Object wizard to add an Automation server or ActiveX server object to an ActiveX Library project. In order to open the wizard, you must have an ActiveX Library open. The wizard creates a type library, and the definition for the Automation object.

You can register your automation object on either a per-user basis or for all users. For more information, see Registering a COM Object and Current-User Registration for ActiveX Servers.

Item Description

CoClass Name

Specify the class whose properties and methods you want to expose to client applications. (Object Pascal prepends a T to this name.)

Instancing

Specify an instancing mode to indicate how your Automation server is launched.

Threading Model

Choose the threading model to indicate how COM serializes calls to your Automation object's interface. The threading model you choose determines how the object is registered. You must make sure that your object implementation adheres to the model selected.

Generate Event support code

Check this box to tell the wizard to implement a separate interface for managing events on your Automation object. The separate interface has the name ICoClassNameEvents, and defines the event handlers that must be implemented by the client. Your application does not implement this interface.



The Instancing dropdown list can have any of the following instancing types:

Instancing Meaning

Internal

The object can only be created internally. An external application cannot create an instance of the object directly.

Single Instance

Allows only a single COM interface for each executable (application), so creating multiple instances results in launching multiple instances of the application.

Multiple Instance

Specifies that multiple clients can connect to the application. Any time a client requests the object, a separate instance is created within a single process space. (That is, there can be multiple instances in a single executable.)



Note: Under COM+, the serialization of calls to your object is also influenced by how it participates in activities. This can be configured using the COM+ page of the type library editor or the COM+ Component Manager.

The Threading Model dropdown list can have any of the following values:

Threading Model Meaning

Single

Clients are handled one at a time, so no threading support is needed.

Apartment

Only one client thread can call the object at a time. All client calls use the thread in which the object was created. You must protect global data using critical sections or some other form of serialization.

Free

Each object instance may be called by multiple threads simultaneously. You must protect instance data as well as global memory.

Both

This is the same as the Free-threaded model, except that all callbacks supplied by clients are guaranteed to execute in the same thread. This means you do not need protect values supplied as parameters to callback functions.

Neutral

Multiple clients can call the object on different threads at the same time, but COM ensures that no two calls conflict. You must guard against thread conflicts involving global data and any instance data that is accessed by more than one method. This model should not be used with objects that have a user interface. This model is only available under COM+. Under COM, it is mapped to the Apartment model.


Note: Under COM+, the serialization of calls to your object is also influenced by how it participates in activities. This can be configured using the COM+ page of the type library editor or the COM+ Component Manager.

See Also