怎样将dll,ocx注册和取消,不用regsvr32在delphi6中? (0分)

  • 主题发起人 topsuper
  • 开始时间
T

topsuper

Unregistered / Unconfirmed
GUEST, unregistred user!
[:D]我想将一些dll,ocx注册和取消,不用regsvr32在程序中如何写?
请帮忙!
 
自己调用 dll,ocx 文件中的注册注销函数。
 
//[2-16]注册dll或ocx文件
function reg_dll1(fn1:string):boolean;
type
TprocStdcall=procedure;stdcall;
var
dp1:TprocStdcall;
dh1:Thandle;
begin
result:=true;
try
dh1:=loadlibrary(pchar(fn1));
except
result:=false;
exit;
end;

try
if (dh1<>0) then
begin
@dp1:=getprocaddress(dh1,pchar('DllRegisterServer'));
if (@dp1<>nil) then dp1;
end;

except
result:=false;
end;
try
FreeLibrary(dh1);
except
end;
end;
 
winexec('regsvr32 /u ......',0);
 
请问如何用程序注销ocx,dll,就象real_clq所说的
谢谢!!!
 
下面这个函数早就写过了,不过没用过。你试试。
//[2-44]反注册dll或ocx文件
function unreg_dll1(fn1:string):boolean;
type
TprocStdcall=procedure;stdcall;
var
dp1:TprocStdcall;
dh1:Thandle;
begin
result:=true;
try
dh1:=loadlibrary(pchar(fn1));
except
result:=false;
exit;
end;

try
if (dh1<>0) then
begin
@dp1:=getprocaddress(dh1,pchar('DllUnregisterServer'));
if (@dp1<>nil) then dp1;
end;

except
result:=false;
end;
try
FreeLibrary(dh1);
except
end;
end;
 
感谢!real_clq
按照你的方法,可以拉!
但我对程序还是不很理解,你能详细的介绍一下吗?
谢谢!
 
唉,怎么说呢。'DllUnregisterServer'和'DllRegisterServer'是每个可注册/反注册的dll
或ocx文件中都有的函数,我们只不过是调用它就可以了。--当作普通的dll导出函数一样
调用。
这是我的理解,不知说清楚了没有。唉,可惜没有分。
 
顶部