Using ActiveX Components

Question

Is there a tutorial or guide that shows the steps to use an non-visible ActiveX component? I have a Visual Basic ActiveX EXE component that does a string maninpulation. I want to be able to use Delphi to use the procedure built into the component. I used the import component in Delphi and it created a TLB file but I don't know how to actually get it to work.

Answer

Importing an ActiveX control is pretty much the same for all versions of Delphi:

1. Select Component / Import ActiveX Control.
2. In the dialog window that opens, select the ActiveX control that you wish to import, for example: "CCRP Animation Control" (CCRPANI6.OCX).
In the box labeled "Class names", you will see the classes that are contained in this ActiveX; in my example, this was only one class: TccrpAnimation.
3. In the same dialog, select the "Palette Page" where you wish to add the component(s). You can leave the ActiveX option selected.
4. Click the Install button.
5. Select an existing package where the new control(s) must be installed, or create a new package.
6. Click OK.
7. Delphi will ask you whether you want to rebuild the package or not. Click the Yes button.
8. After the package is compiled, Delphi says in a message that the new ActiveX component is registered, TccrpAnimation in our example. Click OK.
9. Close the package detail window.

The new component is now available on the ActiveX component palette page, or on another palette page if you changed this in step 3. It's ready to be used in your applications.

Important:

1. The ActiveX component is linked into the executable file of your program that you uses this component. However, you MUST ALSO distribute the .OCX file with your application!

2. An ActiveX control needs to be registered on the computer before its first use. Thus, on every computer where you install an application that uses your ActiveX.
Installation programs, such as InstallShield, automatically take care of this registration.