Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

service name

Posted on 2001-07-22
5
Medium Priority
?
252 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
[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
  • 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

705 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