Solved

Register OCX

Posted on 2001-08-08
4
290 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 92
Delphi 2 77
How to insert .png images to TClientDataSet .cds file? 2 73
Delphi Firemonkey : user drawing in window 3 28
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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

726 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