Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all, I need to run WinForms application on Windows Server 2008 every 5 minutes while no user is logged on. In old Windows versions UI was enabled, but now, with Session0 Isolation it is not possible to run application correctly. I tried to create a ScheduleRunner program that uses CreateProcessAsUser Win32 API function to run my application, but it does not work as well (UI is not working).

What should I do to get it working?

Thanks in advance.
Posted

Hi first of all, since invention of Vista OS, all users works in separated session , which differs from Session 0, and they have appropriate desktop instance for their session.
As far as i know, there is no Desktop instances for session 0, whereas this session intended for NT services
But i might be wrong.
Check it with help of WinApi method
C++
EnumDesktops

Good luck to you!
 
Share this answer
 
You have to rewrite the application as a service. If no user is logged in, there's no reason to show an interface anyway, so what's the point??

You cannot get around the Session 0 limitation. All services that try to show a UI will now be shown on an alternate desktop and the user, if any, will be notified that a service wants them to see something and if it would be OK to switch to the alternate desktop.

This is a security feature and an intermediate move to force developers to do things the correct way and stop us from writing services that show a UI.

The correct way to do this would have been to write your app as a service to do the work. The service would also expose an interface for a user application to connect to to communicate with the service and send/get data to/from it.
 
Share this answer
 
Comments
Dusan Paulovic 7-Jun-12 2:30am    
The point of showing interface is that it uses ActiveX control which needs to think it is visible to produce output.

That control is not shown, but needs to create handle (at least) to be able to work. Does that alternate desktop allow control creation? Is that limitation related to modal dialogs?

In other words, my service does not need any user interaction, all it needs is to be able to create a DC and generate some outputs.
Dave Kreskowiak 7-Jun-12 17:25pm    
The alternate desktop let's you do anything you want. The problem is that whoever is logged into the console will get prompted to switch to the alternate desktop if they want to see this window.

I'd seriously look for a replacement for that control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900