?
Solved

Get Path of application from Reg (Run) (win2000)

Posted on 2005-04-07
10
Medium Priority
?
299 Views
Last Modified: 2010-04-05
Hello Experts!

 PLease help me, i want to get path of apps in  key Run of
registry and result are, for example:

 "C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe"
or
 "C:\Program Files\McAfee\QuickClean\Plguni.exe" /START
or
 mobsync.exe /logon

 i want get full path (eg: Remove "", parameter/,...)

ex:  
 C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe
 C:\Program Files\McAfee\QuickClean\Plguni.exe

 Thank you.
 
0
Comment
Question by:z27
9 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 200 total points
ID: 13733627
place a TListBox named ListBox1 on your form and use the code below:

uses
  Registry;

procedure TForm1.Button1Click(Sender: TObject);
var
  Reg         : TRegistry;
  ST          : TStringList;
  counter     : Integer;
begin
  Reg := TRegistry.Create;
  ST := TStringList.Create;
  try
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', False) then
      begin
        Reg.GetValueNames(ST);
        for counter := 0 to ST.Count-1 do
          ListBox1.Items.Add(Reg.ReadString(ST[counter]));
      end;
  finally
    ST.Free;
    Reg.Free;
  end;
end;
0
 

Author Comment

by:z27
ID: 13733908
Yes, but i want to parse string:
  "C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe"
to: C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe
  (remove " ")

mobsync.exe /logon
to: mobsync.exe ( remove  /logon)

 
 
0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 13733936
StringReplace(yourstring, '"', '', [rfReplaceAll])
will remove those " from the string
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 12

Expert Comment

by:Ivanov_G
ID: 13736363
first as mikelittlewood suggested
 StringReplace(yourstring, '"', '', [rfReplaceAll])

and them
  ExtractFileName(....) to get the filename without directory and parameters
0
 

Author Comment

by:z27
ID: 13741860
i want to get full path og app, my app need to read registry (autorun) to finding apps register autorun and locating them on harddisk. But 0n win2000  get some string as asked on topic, i donnot know how parse these strings to get exactly their path.
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 13742620
check the following functions in Delphi help.

ExtractFileDir
ExtractFileDrive
ExtractFileExt
ExtractFileName
ExtractFilePath
0
 

Author Comment

by:z27
ID: 13742821
hello Ivanov_G, please read my question again!

 You cannot Extract...('"C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe"');

or

Extract...('mobsync.exe /logon');
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 13743670
You can not get the full path for mobsync.exe, because it is somewhere in %SYSTEM% folder. For other files you can freely use the function I showed above + StringReplace to create some logic to extract the file paths. You can also use FileExists function to check if the specified file exists on the local machine.
0
 
LVL 14

Expert Comment

by:cwwkie
ID: 16412288
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
   Accept: Ivanov_G {http:#13733627}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

cwwkie
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
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…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month9 days, 10 hours left to enroll

609 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