Delphi2007 下安装ActiveX控件[通俗易懂]

2022-08-27 16:01:18 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

此英文文章来自codegear官方网站,但是是讲在BDS2006 下如何安装,我在delphi 2007下用此方法,一样通过,原文如下

Description:

How to import an ActiveX control in BDS 2006?


Answer/Solution:

Here’s the procedure for importing and installing an ActiveX control in BDS 2006.

(1) Open BDS 2006 and select File | New | Package – C Builder.

(2) Select Component | Import Component, select the appropriate kind of component, then hit Next.

(3) Click the Add button and select your .ocx, .dll, .tlb, and so forth, file. Highlight the component in the list of controls and hit Next.

(4) Set the Palette Page (this is where the component will appear in the tool palette) and pay attention to the Unit Dir Name field. The Unit Dir Name is the directory where your component’s .cpp, .h, and other files will be generated. Hit Next.

(5) Select “Add unit to PackageName.bdsproj project” and hit Finish.

(6) Bring up the Project Manager and right-click on the package (the .bpl file) and click Install. This will build, register, and install the component into the tool palette.

Some additional notes follow. These are not vital to the control importation process but will help explain what happens…

** In step #5, if you don’t want the component to be installed into the tool palette, then select “Create unit” instead. The generated files will go into the directory specified by Unit Dir Name, which is C:/Program Files/Borland/BDS/4.0/Imports by default, and can still be used in your code.

** Be sure to save your package project. The .bdsproj file is your package’s project file, and the .bpl file is the compiled package.

==========================下面是我看了以后实验的具体步骤===========================

How can I install an external ActiveX control (.OCX file) in Delphi 2007 ?

Click File > New > Package Save the Package project. Click Component > Import Component Select Import ActiveX control. Select ActiveX-control in list or click Add and browse the for file. Fill in component details, like name and palette page. Optionally set unit directory to same location as where you saved the package project. Optionally check Generate component wrappers. Select Add unit to Package and Finish. Right click on the Package in Project manager to Build and Install package.

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/146432.html原文链接:https://javaforall.cn

0 人点赞