본문 바로가기
Delphi, RadStudio

[개발/delphi] how to register an OCX

by SB리치퍼슨 2011. 12. 12.
[delphi] How to register an OCX

http://www.delphifaq.com/faq/delphi_windows_API/f515_0.htm

program RegisterMyOCX;
uses
  OLECtl, Windows, Dialogs;
var
  OCXHand: THandle;
  RegFunc: TDllRegisterServer;   //add  to the uses clause
begin
  OCXHand:= LoadLibrary('c:\windows\system\test.ocx');
  RegFunc:= GetProcAddress(OCXHand, 'DllRegisterServer');  //case sensitive
  if RegFunc <> 0 then 
    RegFunc
  else
    ShowMessage('Error!')
  FreeLibrary(OCXHand);

  // You can the same way unregister the OCX: 
  // replace 'DllRegisterServer' by 'DllUnregisterServer'
end.
반응형

댓글