Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to take over just one screen of multiple screens completely with .NET on Windows?

Tags:

c#

.net

directx

With .NET (any version) running on Windows XP/Vista/7/8 - is it possible to reserve one screen for a full-screen application and display data/graphics/whatever on it whilst keeping any other screens available for Windows UI user interaction such as the desktop or other apps?

The usage scenario / rules here are the following:

  1. The PC must be able to run all programs as-is.

  2. No interactivity is required on the .NET contents (i.e. no keypresses, mouse clicks etc).

  3. No other UIs or dialogs from other applications can penetrate the one predefined screen reserved for showing the output from the .NET executable.

  4. The predefined screen with the .NET contents must not have a visible mouse cursor AND the other screens must have their cursor boundaries as if there was no extra screen at all (i.e. the cursor must stop at the edges of the one or multiple desktops).

  5. The content must be visible even if the PC is locked (i.e. user is logged in but the workstation is locked from Explorer).

I know I could achieve this with some external USB controller that drives a secondary monitor or other display device and then manually build the contents/graphics to be pushed to this interface but I'm asking can I do this with the normal WDDM drivers w/ normal monitors?

Edit: To further clarify - I understand there are multiple approaches to achieve a somewhat similar result but the question here is can one comply with all of the specifications/rules above.

like image 828
allu Avatar asked Feb 13 '13 18:02

allu


People also ask

How do I navigate multiple screens in windows?

To switch between virtual desktops, open the Task View pane and click on the desktop you want to switch to. You can also quickly switch desktops without going into the Task View pane by using the keyboard shortcuts Windows Key + Ctrl + Left Arrow or Windows Key + Ctrl + Right Arrow.


1 Answers

It sounds to me like you are designing a .NET application that will be used purely for output (i.e to display a graph/chart, video etc). The application must have a dedicated monitor, and no other application (or even the cursor should be able to enter the bounds of the monitor).

My gut feeling is that whilst you can force your application to a particular monitor (XBMC has this functionality), I doubt you can prevent all of your other applications from entering the monitor's display region.

When I read the question, something in my head clicked and I thought "maybe you want something similar to cpu affinity, which you can set in windows, and force your application to only use particular cpu cores...maybe there is something similar for monitors/display regions?"

Sure enough, Windows provides these functions:

http://msdn.microsoft.com/en-gb/library/windows/desktop/dd375340(v=vs.85).aspx

http://msdn.microsoft.com/en-gb/library/windows/desktop/dd375338(v=vs.85).aspx

You should be able to pinvoke these without much trouble. However that will only solve you being able to force your application only a particular monitor. As for every other application in the system, I doubt you will be able to control their display affinity easily.

At a rough guess, you would need to use another Win32 API call to get references to all window handles in the system, and check their display affinity, and if they are displaying in your dedicated monitor, move them elsewhere.

this might help with getting all window handles:

How to get list or enumerate all handles of unmanaged windows with same class and name

http://msdn.microsoft.com/en-us/library/ms633497%28VS.85%29.aspx

Just thought I would throw this in there, it may not be helpful, but hopefully that should give you some more direction.

EDIT: I found this too...might be of some use

Reserve screen area in Windows 7

like image 117
Matthew Layton Avatar answered Sep 18 '22 09:09

Matthew Layton