Solved

service name

Posted on 2001-07-22
5
242 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 100 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 improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

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