Solved

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

Posted on 2009-07-02
4
1,069 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 250 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

724 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