Solved

Register OCX

Posted on 2001-08-08
4
283 Views
Last Modified: 2010-04-06
Hi,

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().

regards
Paulo
0
Comment
Question by:paulo_psa
  • 2
4 Comments
 
LVL 13

Expert Comment

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

Accepted Solution

by:
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.

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

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


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


The Crazy One
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 6366345
Oops I forgot

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

and
var
  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.
0
 

Author Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

707 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

19 Experts available now in Live!

Get 1:1 Help Now