Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

service name

Posted on 2001-07-22
5
Medium Priority
?
253 Views
Last Modified: 2010-04-06
Hi,
im installing a service and would like to call servicestart() straight after but cant see how without knowing the service name first to pass to it..
i have one solution but i wonder if anyone knows better way.
my solution was :

after installing i can get a list of services from the registry
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services
and search each subkey for the "ImagePath" item that contains the exe name and then if the imagepath contains the exe name i know the subkey is the name of the service

any other ideas?
0
Comment
Question by:inthe
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6307146
EnumServicesStatus?
0
 
LVL 17

Author Comment

by:inthe
ID: 6307331
Hi,
EnumServicesStatus does just that ,
gets the status of a service ..i could do with a EnumServices() or a
GetServiceNameFromFile(filename:string);
 function :-)
0
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 400 total points
ID: 6307584
Hi inthe, :)

EnumServicesStatus enumerates through all services, returning an array of ENUM_SERVICE_STATUS

Just loop through the ENUM_SERVICE_STATUS structure, for the structure contains 3 fields, the ServiceName, DisplayName and the ServiceStatus.


DragonSlayer.
0
 
LVL 17

Author Comment

by:inthe
ID: 6309826
Hi,
ok so im blind and stupid ;-)
the example i had of EnumServicesStatus was not coded right that why it returned only one service,it was also looking for SERVICE_STOPPED instead of SERVICE_INACTIVE.
took a while to get it working correct but now its working,just need to add the compare code to test for service name.

ps,
sorry for delay ,i got confused when looking on newsgroups for examples as there were so many that do not work,or worse some do work but only return 30 or so services when it shouldve returned 60 like it is now.

thanks for showng right path to take anyways :-)

Regards Barry
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6310666
No probs... that's what ExpertsExchange is for, rite? To "open each others' eyes"  :)


DragonSlayer
0

Featured Post

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.

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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

926 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