?
Solved

Register OCX

Posted on 2001-08-08
4
Medium Priority
?
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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

Industry Leaders: 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

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…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 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