Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect if a service is running in Vista? EnumWindows?

Status
Not open for further replies.

fyndor

Programmer
Apr 25, 2007
3
US
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.
 
Normally a service is not visible. Use Spy++ and you'll see what I mean. ONLY if you active the service with "Interact with desktop" option, the windows of the service will show up in spy++ (and in FindWindow).

if you want to see if a certain process(= service or application) is running, use CreateToolhelp32Snapshot API to list all processes.

google this API with delphi and you'll find some code samples how to do this...

Cheers,
Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top