본문 바로가기
IT-개발,DB

[개발/MFC] regsvr32.exe 를 사용하지 않고 ActiveX DLL을 레지스트리에 등록하기

by SB리치퍼슨 2011. 8. 1.

[개발/MFC] regsvr32.exe 를 사용하지 않고 ActiveX DLL을 레지스트리에 등록하기

activeX DLL 을 regsvr32를 사용하지 않고 등록하는 방법이 델파이로 된게 있어서 가져왔다.
직접 만들어서 해볼려고 하니 시간이 부족하다...


Unit Unit1;

Interface

Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

Type
TForm1 = Class(TForm)
btRegistryDll: TButton;
btUnRegistryDll: TButton;
Procedure btRegistryDllClick(Sender: TObject);
Procedure btUnRegistryDllClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
End;

Var
Form1: TForm1;

Implementation

{$R *.DFM}

Procedure TForm1.btRegistryDllClick(Sender: TObject);
Type
TDllRegisterServer = Function: HResult; stdcall;
Var
DllRegisterServer: TDllRegisterServer;
hinstance1: HINST;
Begin
hinstance1 := LoadLibrary('Project2.dll');
DllRegisterServer := GetProcAddress(hinstance1, 'DllRegisterServer');
If Assigned(DllRegisterServer) Then DllRegisterServer;
FreeLibrary(hinstance1);
End;

Procedure TForm1.btUnRegistryDllClick(Sender: TObject);
Type
TDllUnregisterServer = Function: HResult; stdcall;
Var
DllUnregisterServer:TDllUnregisterServer;
hinstance1: HINST;
Begin
hinstance1 := LoadLibrary('Project2.dll');
DllUnregisterServer := GetProcAddress(hinstance1, 'DllUnregisterServer');
If Assigned(DllUnregisterServer) Then DllUnregisterServer;
FreeLibrary(hinstance1);
End;

End.


출처: http://blog.naver.com/erroring/150097804539

 
반응형

댓글