Solved

Including Extra Registry Settings when Registering an OCX

Posted on 2003-11-26
4
238 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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