the right way is: in the menu go
to [project] then import type library and choose the component :-)
|
Type Library
A type library (.tlb) is a binary file that stores information about a COM or DCOM object's properties and methods in a form that is accessible to other applications at runtime. Using a type library, an application or browser can determine which interfaces an object supports, and invoke an object's interface methods. This can occur even if the object and client applications were written in different programming languages.
Luckily, Delphi can "import" a type library. This consists essentially of
reading the information and creating a Delphi unit which will contain a
class defining ahscript's only object and its
methods.
Below are the steps required to import a type library, first in Delphi2010 and after in Delphi 7. Just a reminder: either the AHSDK or the ActiveHomePro software must be installed. During either of these installations, ahscript.dll is registered (added under the appropriate key in the Windows registry) and that is how Delphi can find the type library.




x10Server,
Delphi expanded it to C:\Program Files
(x86)\Embarcadero\RAD Studio\7.0\OCX\Servers\x10Server.dpk.
The description is up to you. Then click Finish.

ActiveHomeScriptLib_TLB is created, saved in the
Import folder {userdocs}\RAD Studio\7.0\Imports
and opened in Delphi's source editor. An information dialogue is then displayed telling you that all the work has been done for you! Click on OK:

If you scroll through the source, you will find a number of constants
and type declarations ending with the definition of a single class
TActiveHome = class(TOleControl)
and a Register procedure. Pay attention to
the warning. We will come back to that later.
Actually Delphi did quite a bit more than
create the ActiveHomeScriptLib_TLB.pas file.
It created a dcr (a bitmap to be shown on the
component palette)
in the same folder. In addition to the file x10Server.dpk
the files x10Server.res and x10Server.dproj
were created in the folder C:\Program Files
(x86)\Embarcadero\RAD Studio\7.0\OCX\Servers\. And as
promised a bpl file was created and installed in Delphi.

If you have Delphi2010 you can now move on to the next page to see how the component can be used. If you have Delphi 7 than you can see below how to import the type library. If you have a different version of Delphi, hopefully these two examples will guide you and you will be able to import the type library.

3. Select the ActiveHomeScript 1.0 Type Library (Version 1.0) and then choose a Palette Page where the component will be made available (here ActiveX), make sure that the check box Generate Component Wrappers is checked and then click on the Install button

4. In the New Package tab, add File
(package name) and a Description.
For the package name, I wrote x10Server.
The description is up to you. Then click OK.
5. Delphi will then warn you that it is about to build the package. Click on Yes.

6. Delphi now tells you that it has built the
package. The unit ActiveHomeScriptLib_TLB.pas and
the bitmap ActiveHomeScriptLib_TLB.dcr
were created and saved in the
Import folder C:\Program
Files
(x86)\Borland\Delphi7\Imports\. Click on OK.

7. Do not forget to save changes when you close the x10Server.dpk window; click on Yes.

C:\Program Files
(x86)\Borland\Delphi7\Projects\Bpl\x10Server.bpl
C:\Program Files (x86)\Borland\Delphi7\Projects\Bpl\x10Server.dcp
C:\Program Files (x86)\Borland\Delphi7\Lib\x10Server.cfg
C:\Program Files (x86)\Borland\Delphi7\Lib\x10Server.dof
C:\Program Files (x86)\Borland\Delphi7\Lib\x10Server.dpk
C:\Program Files (x86)\Borland\Delphi7\Lib\x10Server.res
ActiveHomeScriptLib_TLB.pas generated
by Delphi 7 and Delphi 2010. Just before the reserved word interface,
there are 5 compiler directives inserted by Delphi 2010, and
only 4
by Delphi 7:
{$TYPEDADDRESS OFF} // Unit
must be compiled without type-checked
pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
{$ALIGN 4} // <-- not included in Delphi 7 version !!
interface
We are now ready to talk to the CM15A.