📄 register.pas
字号:
unit Register;
interface {程序:斗鱼 2005 QQ:13335085}
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ActiveX;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Label2: TLabel;
Label1: TLabel;
OpenDialog1: TOpenDialog;
procedure Edit1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
OCXHand:THandle;
RegFunc:TDLLRegisterServer;
implementation
{$R *.dfm}
procedure TForm1.Edit1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
Handled:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.InitialDir:=ExtractFilePath(Application.Exename);
if not OpenDialog1.Execute then exit;
begin
try
Edit1.Text:=OpenDialog1.FileName;
OCXHand:=LoadLibrary(PChar(OpenDialog1.FileName));
RegFunc:=GetProcAddress(OCXHand, 'DllRegisterServer');
ShowMessage('文件:'+OpenDialog1.FileName+'注册成功!');
if RegFunc <> 0 then
ShowMessage('Error!');
finally
FreeLibrary(OCXHand);
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
OpenDialog1.InitialDir:=ExtractFilePath(Application.Exename);
if not OpenDialog1.Execute then exit;
begin //DllRegisterServer 注册OCX
try //DllUnregisterServer 反注册OCX
Edit1.Text:=OpenDialog1.FileName;
OCXHand:=LoadLibrary(PChar(OpenDialog1.FileName));
RegFunc:=GetProcAddress(OCXHand, 'DllUnregisterServer');
ShowMessage('文件:'+OpenDialog1.FileName+'反注册成功!');
if RegFunc <> 0 then
ShowMessage('Error!');
finally
FreeLibrary(OCXHand);
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -