Solved

Including Extra Registry Settings when Registering an OCX

Posted on 2003-11-26
4
235 Views
Last Modified: 2010-04-05
I have made an OCX, and I need it to include extra registry settings when the OCX is registered.

For example

This is the default when I register my OCX:

[OCX.NAME]
  [CLSID]
    (Default) = {A408E0E2-B087-4EF7-8B46-34AE6B3C71D4}

This is what I want it to be after registation

[OCX.NAME]
  [CLSID]
    (Default) = {A408E0E2-B087-4EF7-8B46-34AE6B3C71D4}
  [shell]
    [open]
      [command]
        (default) = "iexplore.exe" "%1"

I also need to add entries under the MIME/Content Type key.

I'm not looking for a solution that updates the registry when the OCX is opened/loaded as there will permission issues.




 
0
Comment
Question by:StayGreedy
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
DeerBear earned 250 total points
ID: 9824561
Hi,

I stated some time ago in this site how to do it.
Have a look at the COM demos, there's an UpdateRegistry method
somewhere <g>( I don't remember *where*, but I'm sure there's one :-) ),
that you can override and integrate to add your registry settings.

HTH,

Andrew
0
 
LVL 1

Author Comment

by:StayGreedy
ID: 9873820
After a lot of hard work, I final solved my problem

For any of you out there that may need this:

Unit MyActiveForm

...

Implementation

type
  TmyActiveFormFactory= class(TActiveFormFactory)
  public
    procedure UpdateRegistry(Register: Boolean); override;
  end; //}

procedure TmyActiveFormFactory.UpdateRegistry(Register: Boolean);
begin
  if Register then
  begin
    inherited UpdateRegistry(Register);
    with TRegistry.Create do
    try
      // Add my Registry Setting
    finally
      Free;
    end;
  end
  else
  begin
    with TRegistry.Create do
    try
      // Remove my Registry Setting
    finally
      Free;
    end;
    inherited UpdateRegistry(Register);
  end;
end;

...

initialization
  TmyActiveFormFactory.Create(
    ComServer,
    TActiveFormControl,
    TSimpleTiffViewer,
    Class_SimpleTiffViewer,
    1,
    '',
    OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL, tmApartment);
end.


0
 
LVL 5

Expert Comment

by:DeerBear
ID: 9873914
Hi,

I told you there was UpdateRegistry :-)

Yet, I'm wondering what "hard work" was necessary since you may
have found it on the help file( which I hadn't available ) very quickly.

Andrew
0
 
LVL 1

Author Comment

by:StayGreedy
ID: 9876007
The examples you pointed me to are for COM not for ActiveForms, and as I am new to ActiveX programming, it took me lots of trial and error to get it to work.

However, I am extremely grateful for you pointing me in the right direction.

Cheers.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

22 Experts available now in Live!

Get 1:1 Help Now