Screen information while Windows system is locked (.NET)

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-03-15T14:38:11Z Indexed on 2010/03/15 15:09 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

We have a nightly process that updates applications on a user's pc, and that requires bringing the application down and back up again (not looking to get into changing that process).

The problem is that we are building a Windows AppBar on launch which requires a valid screen, and when the system is locked there isn't one in the Screen class. So none of the visual effects are enabled and it shows up real ugly.

The only way we currently have around this is to detect a locked screen and just spin and wait until the user unlocks the desktop, then continue launching. Leaving it down isn't an option, as this is a key part of our user's workflow, and they expect it to be up and running if they left it that way the night before.

Any ideas?? I can't seem to find the display information anywhere, but it has to be stored off someplace, since the user is still logged in.

The contents of the Screen.AllScreens array:

** When Locked:

Device Name    : DISPLAY
Primary        : True
Bits Per Pixel : 0
Bounds         : {X=-1280,Y=0,Width=2560,Height=1024}
Working Area   : {X=0,Y=0,Width=1280,Height=1024}

** When Unlocked:

Device Name    : \\.\DISPLAY1
Primary        : True
Bits Per Pixel : 32
Bounds         : {X=0,Y=0,Width=1280,Height=1024}
Working Area   : {X=0,Y=0,Width=1280,Height=994}

Device Name    : \\.\DISPLAY2
Primary        : False
Bits Per Pixel : 32
Bounds         : {X=-1280,Y=0,Width=1280,Height=1024}
Working Area   : {X=-1280,Y=0,Width=1280,Height=964}

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET