Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Register OCX

Posted on 2001-08-08
4
Medium Priority
?
295 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

610 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