11

I've spent the past few days researching whether its possible to use the Windows API (Preferably Windows 8) to develop an application that can utilize the features in a multiple physical monitor configuration, from a single physical monitor. As far as I can tell you simply cannot do it, or its just not documented at all. Below I will present my problem and the research I've under-taken in the hopes that someone can provide some knowledge I have not yet encountered.


The Problem

In Windows 7+ multi-monitor configurations are able to utilize some cool desktop features such as being able to use a single large desktop that spans multiple monitors, seamless application dragging between them, ability to toggle whether to have the taskbar span or not, etc.

The Virtual Screen (MSDN link). enter image description here

I would like to gain access to this API and allow my application to use it to allow the user to effectively have multiple virtual desktops from a single physical monitor. Simple as that.


The Solution

Here I will present a number of proposed solutions I have found, and why they will not work (As far as I can tell).

1. Use the Window Station & Desktop API to create entirely new desktops and flip between them.

"A window station is a securable object that is associated with a process, and contains a clipboard, an atom table, and one or more desktop objects. A desktop is a securable object contained within a window station. A desktop has a logical display surface and contains user interface objects such as windows, menus, and hooks." MSDN Link.

This is a really clean and simple way to effectively create multiple desktops in windows that allows the user to switch between on a single monitor. However it has the following large caveat:

"Windows doesn't provide a way to move a window from one desktop object to another, and because a separate Explorer process must run on each desktop to provide a taskbar and start menu, most tray applications are only visible on the first desktop." Sysinternals on TechNET.

2. Attempt to create a fake display driver to force Windows to believe it has more than one monitor.

This appears to have been a valid option for a couple of existing similar applications such as ZoneScreen. However in Windows 7 it became difficult to install the unsigned driver and in Windows 8 it appears to be flat out impossible.

3. Fake it by attempting to track applications and force them to hide between user defined monitor groups.

Both commercial and free applications such as DisplayFusion and Finestra Virtual Desktops appear to use a highly convoluted and complex system of tracking launched applications and attempting to hide and unhide them as the user switches between virtual monitors.

This is the most workable solution as it largely meets all the requirements. But its a hack - Some applications don't really work with it and there are many corner cases where it will fail.


What am I missing here? Is any of my research incorrect thus far? Are there areas of the API that I haven't yet plumbed?

S.Richmond
  • 11,412
  • 6
  • 39
  • 57
  • 1
    Small note to the Problem: Multi-monitor support exists long time ago before Windows 7. Also what do you mean in the 'setup' ? – Xearinox Dec 04 '13 at 05:28
  • 1
    Solution 4: look at this "old" tool from sysinternals http://technet.microsoft.com/en-us/sysinternals/cc817881.aspx – ColdCat Dec 04 '13 at 11:31
  • 1
    @ColdCat - Yes I have that already linked in my post. See solution 1. – S.Richmond Dec 04 '13 at 11:46
  • 1
    ouch don't phone and write sorry. The pb with multiple monitors is that we miss some API I agree. I used to do some tricky windows moving by calculating coordinates of each windows and match to monitors. I was never pleased with any solutions. – ColdCat Dec 04 '13 at 11:52

1 Answers1

1

develop an application that can utilize the features in a multiple physical monitor configuration, from a single physical monitor

The Windows API ties each desktop to a explorer process and the taskbar,notifications etc are managed on a per-desktop basis. It is possible to create new virtual desktops using this API by creating a new desktop object. However if you are trying to create something that is the equivalent of workspaces in linux distros, then you are out of luck. The desktop object manages the applications launched under a process tree and moving applications between these desktop objects etc is not possible due to the way windows explorer handles work.

The Solution

Here I will present a number of proposed solutions I have found, and why they will not work (As far as I can tell).

The only way to achieve something close to workspaces is to fake it -

each workspace and its process have to be show in the taskbar/notification area by slots. But this is very tough to achieve and games, fullscreen apps etc are bound to break. I am not aware of how this will work out in Win8 either. So yes - workspaces in Windows are going to suck from the get-go.

Community
  • 1
  • 1
amarprabhu
  • 350
  • 3
  • 10
  • Sadly those are the conclusions I had already drawn in my original post. – S.Richmond Dec 04 '13 at 11:43
  • So you are trying to achieve full fledged workspaces huh - Win 8 is sure to break, even is Win7 does ok. Is there any particular reason the existing hacks/programs are insufficient? I have played around with the Windows API and it is capable of doing a lot of things except what you are looking for. – amarprabhu Dec 04 '13 at 11:47
  • More or less yes. I could do the process hiding 'trick' but as you say will not work in all cases and is bound to break. My last remaining item of investigation is whether I can write a virtual display driver. – S.Richmond Dec 04 '13 at 11:51
  • 3
    Virtual display drivers are not a complete solution either. For instance, even after you write one, you will have to manage to get these to show up in a single screen and switch between them. This might not make for a great UX as you wont have the bells and whistles other solutions provide. The memory consumed to launch each desktop and keep it running in the background will be significant, IMHO. The advantage however would be that you will have a true workspace/application switching experience. Question is - is it worth the trouble? – amarprabhu Dec 04 '13 at 12:28
  • 4
    Well the hope is that once I make a virtual driver that just drops the renders to null I can have the primary physical monitor switch between the various views as a user would if they wanted to swap the shared desktop sides. Unfortunately I'm struggling with my research into virtual drivers. I simply cannot find many resources for taking this path. Your final question is one I've been weighing up since I started this post - If I can't find an elegant solution I'm going to have to walk away from this sadly. – S.Richmond Dec 04 '13 at 23:06