Solved

Retrieve Path of an exe  in registry.

Posted on 2002-06-26
1
235 Views
Last Modified: 2010-04-04
I need to find out as how to read path of the an .EXE
which is invoked when i create an OLE object which is in that .exe.
This exe path is stored in the resgistry and attached to a CLSID but somehow i am able to retrieve it.

Thanks in advance.
0
Comment
Question by:kashif063098
1 Comment
 
LVL 17

Accepted Solution

by:
geobul earned 300 total points
ID: 7110823
Hi,

Try this one:

uses Registry;

function GetInprocServer32(const clsid: string): string;
begin
  result := '';
  with TRegistry.Create do begin
   try
    RootKey := HKEY_CLASSES_ROOT; { HKEY_CURRENT_USER by default }
    if OpenKey('CLSID\'+clsid+'\InprocServer32', false) then begin
      result := (ReadString(''));
      CloseKey;
    end;
   finally
    Free;
   end;
  end;
end;

// Usage:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(ExtractFilePath(GetInprocServer32('{08229782-89C8-4028-BB74-75BB58EF1488}')));
end;

Regards, Geo
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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