Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Including Extra Registry Settings when Registering an OCX

Posted on 2003-11-26
4
Medium Priority
?
248 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 750 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline
Suggested Courses

810 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