Solved

get services files

Posted on 2010-09-15
5
358 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now