如何自动注册ocx

yz_oracle 2008-01-12 01:55:47
用 delphi 做了一个 ocx ,也做成 cab 了,但是本机测试的时候还是不能看见,然后 手工注册了一下,才可以。
接这用其他机器调用了,ocx 应该已经下载了,但是仍然看不见。

请教各为大师,帮帮我一下,如何自动注册,多谢了!!!
...全文
274 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
diecode 2008-01-14
  • 打赏
  • 举报
回复
两种可能
1 下载没有成功(表面上看下下来了)
2 activeX被禁用了
ghd2004 2008-01-12
  • 打赏
  • 举报
回复
program RegOcxSample;


uses
Forms,
SysUtils,
Dialogs,
ActiveX,
Windows,
Unit1 in 'Unit1.pas' {Frm_Main};


{$R *.res}
var
OCXHand:THandle;
RegFunc:TDLLRegisterServer;
sfile:string;
begin
Application.Initialize;


//运行程序前先注册OCX文件
sfile:=ExtractFilePath(Application.ExeName)+myocx.ocx';
if not FileExists(sfile) then
begin
ShowMessage(myocx.ocx文件丢失,请重新安装程序!');
Application.Terminate;
end;

try
OCXHand:=LoadLibrary(PChar(sfile));
RegFunc:=GetProcAddress(OCXHand, 'DllRegisterServer');
if RegFunc <> 0 then
begin
ShowMessage('myocx.ocx注册失败!');
Application.Terminate;
end;
finally
FreeLibrary(OCXHand);
end;



Application.CreateForm(TFrm_Main, Frm_Main);
Application.Run;
end.


//自己收集的资料

5,402

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧