?
Solved

How do I get EnumWindows working from a Windows Vista Service?

Posted on 2009-07-02
4
Medium Priority
?
1,081 Views
Last Modified: 2012-05-07
Hi Guys,

I have written a program that collects information about programs running on the windows desktop using the EnumWindows API.  My program runs fine on Windows XP when run on the command line or as a service and Windows Vista on the command line.  My program fails though when I try to run my program as a service on Windows Vista.

Does anyone know why EnumWindows does not find any windows when run as a service on Windows Vista?

Thanks
Grant
0
Comment
Question by:Grant Rogers
[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
  • 2
4 Comments
 
LVL 14

Expert Comment

by:uucknaaa
ID: 24761694
Hi

With new service hardening, vista services will run in session 0 and can no longer interact with the desktop.  That's probably what's preventing your service from running.

Hope that helps.
0
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 24762924
That's not new to Vista. All services run on their own desktop without any access to the logged on user's desktop, see http://support.microsoft.com/kb/115825 ("Accessing the Application Desktop from a Service"). Vista has only taken that to a new level with WTS features coming into play. http://blogs.msdn.com/larryosterman/archive/2005/09/14/466175.aspx ("Interacting with Services") should give you an idea on how to procedd by havina an app running in the user's context o the enumeration for you.
0
 

Author Comment

by:Grant Rogers
ID: 24768155
Thanks guys, I will have a look into this and let you know my results.
0
 

Author Comment

by:Grant Rogers
ID: 24821993
Hi jkr,

I have tried the knowlegebase article KB115825 but that did not work.  Are you able to provide some sample code of how to access desktop information from a service?

Thanks
Grant
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

800 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