Project Description
Virtual Desktop - multiple virtual desktops management, free open source.


VirtualDesktop allow use of multiple virtual desktops, similar to have multiple monitors on one pc.

If we work with multiple programs at the same time that not fits on our desktop
we can organize them on more virtual desktops preview them and switch between desktops.


MSDN defines desktop as “A desktop has a logical display surface and contains user interface objects such as
windows, menus, and hooks; it can be used to create and manage windows.”

There is a Win32 functions for desktop management
- CreateDesktop: creates a new desktop
- SwitchDesktop: makes desktop visible and activates it
- …

This program creates desktops and processes on them and switch between them, creates also screenshots
and saves them to image files on disk, in this way can show preview of used desktops.

- VirtualDesktop.exe - executable file for use without installation
- VirtualDesktopSetup.msi - setup installer, install this program on pc
- VirtualDesktopPresentation.doc - product documentation
- VirtualDesktop folder contains source code files
- Desktops.cs – contains class Desktops
- Processes.cs- contains class Processes
- Screenshots.cs – contains class Screenshots
- Form1.cs – contains class Form1

- Desktops – map Win32 functions for desktop management and implement wrappers on them
- Processes – create processes on specified desktop
- Screenshots – create screenshots and save them to image files on disk
- Form1 – application events and methods

Desktops class
Creates opens and switch between desktops …
- public static IntPtr DesktopCreate(string name)
- public static IntPtr DesktopOpen(string name)
- public static bool DesktopSwitch(string name)
- …

Processes class
Creates processes on specified desktop …
- public static bool ProcessCreate(string name, string path, string args)

Screenshots class
Creates screenshots and save them to image files …
- public static Bitmap ScreenCapture(Control control)
- public static void ScreenSave(string filename, ImageFormat format, Control control)

Form1 class
Contains application events and methods, creates desktops and switch between them …
- Form1_Load - start explorer.exe on new created desktop, this initialize desktop & taskbar …
- Form1_Activated – load screenshots from images on disk, get screenshot for the current desktop
- Form1_Deactivate – minimize the application window
- pictureBox1{_}Click - initialize/switch to selected desktop 1, pictureBox2{_}Click for desktop 2 …
- DesktopInitialize - save current screenshot, creates new desktop if not exists and swich to him …
- …

Example code:
public static extern IntPtr CreateDesktop(
    string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, int dwFlags, long dwDesiredAccess, IntPtr lpsa);

/// <summary>
/// Create new desktop, if desktop exists return handle of existent
/// </summary>
/// <param name="name">Desktop name</param>
/// <returns>Desktop handle</returns>
public static IntPtr DesktopCreate(string name)
    return CreateDesktop(name, IntPtr.Zero, IntPtr.Zero, 0, rights, IntPtr.Zero);

}// DesktopCreate

Requirements & Technologies:
- Windows 2000 or more (XP, 2003, Vista, 7 …)
- Net Framework 2.0 (free), C#, Visual Studio 2005 or more

- Free for use and distribute as whole product as is,
cannot be modified used in parts or for commercial purposes.

Author: Ivica Gjorgjievski

- Release 1.1 - fixed issue with permissions when used with multiple users, also window is now resizable.
- Release 1.2 - Code and documentation reorganization, contains code executable installer.

Last edited Dec 24, 2010 at 3:28 PM by IGProgram, version 38