Register OCX

Posted on 2001-08-08
Last Modified: 2010-04-06

I need to register an .OCX comp.
How can I do that programatically like I do with regsvr32.exe, I mean, without give full path('\Software\Microsoft\Windows\CurrentVersion\
bla\bla\bla\bla', True), just regsvr32 name.ocx.
I hope this comp. knows where set up.
Better if I do not need to use winexec().

Question by:paulo_psa
  • 2
LVL 13

Expert Comment

ID: 6366278
Look in the Borland\Delphix\Demos\ActiveX\TRegSvr directory...
LVL 44

Accepted Solution

CrazyOne earned 100 total points
ID: 6366325
This one of the ways I do it now which I go the idea from the TRegSvr pas that Epsylon mentioned in his comment.

  TRegProc = function : HResult; stdcall;
  TRegAction = (raReg, raUnreg);

  LibHandle: THandle;
  RegProc: TRegProc;
  RegAction: TRegAction = raReg;

LibHandle := LoadLibrary(PChar(sFileToRegister));
if LibHandle <> 0 then begin
          @RegProc := GetProcAddress(LibHandle, ProcName[RegAction]);
          if (@RegProc = Nil) or (RegProc <> 0) then
               sMsg := sFileToRegister + ' did not register properly'#13#10;
     sMsg := sFileCopy + ' did not register properly'#13#10;

The Crazy One
LVL 44

Expert Comment

ID: 6366345
Oops I forgot

  ProcName: array[TRegAction] of PChar = ('DllRegisterServer', 'DllUnregisterServer');

  sFileToRegister: string;

and the var sFileCopy should be sFileToRegister and this variable is the file that you are attempting to register. So you need tell the LoadLibrary function the path of the file.

Author Comment

ID: 6386326
Thanks to both of you.
But I just can give the points for one...

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can't connect to Outlook via TOutlookApplication component 15 118
Help on project with Soap 10 47
Multiple image collision 13 69
how to update exe applicatio from internet ? 6 67
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now