Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I utilize the functionality of a multi-monitor setup without physical hardware?

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?

like image 992
S.Richmond Avatar asked Dec 04 '13 05:12

S.Richmond


1 Answers

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.

like image 157
amarprabhu Avatar answered Sep 27 '22 18:09

amarprabhu