×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Detect if a service is running in Vista? EnumWindows?

Detect if a service is running in Vista? EnumWindows?

Detect if a service is running in Vista? EnumWindows?

(OP)
I work for a company who is trying to make their software package work with Vista.  We used to use its built-in function FindWindow to check if a certain service was running at the time of install.  Pre-Vista this worked properly but on vista machines this function returns that the service is not running when it is.  I assume FindWindow is making use of the EnumWindows API call and checking this list for the service they are looking for.  I wrote a Delphi program to list everything returned by EnumWindows.  When I run it on an XP box it returns all normal programs and services, but in Vista it does not include the services.  I think this is the reason that InstallShield's function FindWindow does not work for detecting a Vista service, because they probably used EnumWindows API and it doesn't work to detect services anymore.  So I need to write a DLL or something to check to see if a certain service is running.  How can I do this with Delphi (we use D5) and Vista?  Keep in mind I am developing on an XP machine not a Vista machine so I hope thats not a problem.

RE: Detect if a service is running in Vista? EnumWindows?

Search in MSDN Library for the system-service functions mentioned beneath. You should call :

- OpenSCManager to connect to the services database
- OpenService to get a handle to the service(s) of interest
- QueryStatus to find out if it is running
- CloseServiceHandle to close the "OpenService" handle
- CloseServiceHandle to close the "OpenSCManager" handle

Marcel

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close