Solved

get services files

Posted on 2010-09-15
5
362 Views
Last Modified: 2012-05-10
http://www.delphitricks.com/source-code/systeminfo/get_a_list_of_installed_services.html
that link pointed a list of services, i'd like to list there files also.
please
0
Comment
Question by:systan
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:dr-evil
ID: 33688377
what is your problem?
u can't use code?
0
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 33688441
Use this function and pass in the service manage handle and the service name
ServiceFileName := GetServiceInformation(schm, StrPas(ssa^[j].lpServiceName))

function GetServiceInformation(const SCHandle: THandle; const AServiceName: string): string;
var
  ServiceHandle, StartType: THandle;
  Config: PQueryServiceConfig;
  Bytes_Needed: DWord;
begin
  Result := '';
  try
    ServiceHandle := OpenService(SCHandle,  PChar(AServiceName), SERVICE_QUERY_CONFIG);
    if ServiceHandle > 0 then
      try
        QueryServiceConfig(ServiceHandle, nil, 0, bytes_needed);
        GetMem(config, bytes_needed);
        try
          Win32Check(QueryServiceConfig(ServiceHandle, config, bytes_needed, bytes_needed));
          StartType := config.dwStartType;
          Result := config.lpBinaryPathName;
        finally
          FreeMem(config);
        end;
      finally
        CloseServiceHandle(ServiceHandle);
      end;
  except
  end;
end;
0
 
LVL 14

Author Closing Comment

by:systan
ID: 33688629
ewangoya;
Yes, its doned.

But, I want to ask,   why you know such like this kind of code?  do you have any reference that i could also see and understand more clearer?

Your not a magician I know, thats why I ask how did you know that?  Where did you get the code solution?  Is it because of your years of experience in codes like this?

How did you arrive in this area?

Because me?, I'm really having a hardtime programming with delphi,  but not vb.net and c#.NET.

lol, I'm sorry, but I already accepted your solution, its up to you to reply back or not.

Thanks
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 33697560
I suppose its just from a couple of years of experience I've had with Delphi.
I've come across lots of code on different projects. If you need refence for windows API, take a look at http://msdn.microsoft.com/en-us/library/
The codes are in C so you have to convert to equivalent delphi
0
 
LVL 14

Author Comment

by:systan
ID: 33698128
ah, ok, i see, so 1 man well experienced is better than any number of men when it comes programming.
I think you must have a masters rank also, you should grad it.

Thanks, seeya.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

785 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