Solved

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

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ Language error 28 280
Windows XP on domain not allowing domain admins to RDP in 10 105
VS2015 Redefinition errors 4 91
C++ Code Issue 4 38
Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
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…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

749 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