Author: William Gerbert
How to register an OCX
Answer:
Your installation program needs to register an OCX, but doesn't support this? Or
you want to
register it by your program yourself?
Suppose the OCX you want to use is called
1 program RegisterMyOCX;
2 uses3 OLECtl, Windows, Dialogs;
4 var5 OCXHand: THandle;
6 RegFunc: TDllRegisterServer; //add to the uses clause7 begin8 OCXHand := LoadLibrary('c:\windows\system\test.ocx');
9 RegFunc := GetProcAddress(OCXHand, 'DllRegisterServer'); //case sensitive10 if RegFunc <> 0 then11 RegFunc
12 else13 ShowMessage('Error!');
14 FreeLibrary(OCXHand);
15 16 // You can the same way unregister the OCX:17 // replace 'DllRegisterServer' by 'DllUnregisterServer'18 end.