Show: Delphi C++
Display Preferences

Active Form or ActiveX Control wizard

From RAD Studio
Jump to: navigation, search

Go Up to File Menu

File > New > Other > <personality> > ActiveX > Active Form

File > New > Other > <personality> > ActiveX > ActiveX Control

  • Use the Active Form wizard to add an Active Form to an ActiveX Library project.
  • Use the ActiveX Control wizard to create an ActiveX control from a VCL control that you specify. The properties, methods, and events of the VCL control become the properties, methods, and events of the ActiveX control that the wizard creates.
Note: You must first create an ActiveX Library before you can create either an Active Form or an ActiveX Control. The Active Form and ActiveX Control wizards are not enabled in the New Items list until after you create an ActiveX Library (creating an ActiveX Library creates a Dynamic Link Library [DLL] project, which hosts in-process ActiveX Objects). For instructions, see Using COM Wizards.
Item Description

CoClass Name

Specify the name for the control that you want to implement. This is the CoClass name that appears in the type library. The generated implementation class has the same name with a 'T' prepended.

Description

Provide an optional description of the component you are creating.

Threading Model

(details in section below)

Choose the threading model to indicate how COM serializes calls to the interface of your Active form or ActiveX control. The threading model you choose determines how the control is registered. You must make sure that your implementation adheres to the model selected.The wizard always specifies Apartment as the threading model. This is not a problem if your ActiveX project contains only a single control. However, if you add additional controls to your project, you are responsible for providing thread support.

Component Name

Use the dropdown list to select the VCL component that you want to use as the ancestor of the ActiveX control you are creating. For an Active Form, the component is always TActiveForm.

Interface

Indicates the name of the default interface for the control. By default, the interface of the control is the same as the CoClass name, with an 'I' prepended.

Include version information

You can include version information, such as a copyright or a file description, in the control. This information can be viewed in a browser. Some host clients, such as Visual Basic 4.0, require Version information or they will not host the control. You can specify version information by choosing Project > Options and selecting the Version Info page.


Threading Models

ActiveX controls can use the following threading models:

Model Description

Single

Only one client thread can be serviced at a time. COM serializes all incoming calls to enforce this. Your code needs no thread support.

Apartment

Each control instantiated by a client is accessed by one thread at a time. You must protect against multiple threads accessing global memory, but objects can safely access their own instance data (object properties and members).

Free

Each control 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 control 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.



See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance