Solved

get services files

Posted on 2010-09-15
5
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:
Ephraim Wangoya 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:Ephraim Wangoya
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 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