This is a mirror of official site: http://jasper-net.blogspot.com/

Virtual Desktop

| Sunday, August 29, 2010
Background

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.”
http://msdn.microsoft.com/en-us/library/ms682573(v=VS.85).aspx

There is a Win32 functions for desktop management http://msdn.microsoft.com/en-us/library/ms687107(v=VS.85).aspx
- CreateDesktop: creates a new desktop
- SwitchDesktop: makes desktop visible and activates it
- …

Using the code

VirtualDesktop has three main classes
- Desktops: map Win32 functions and implement simple wrappers on them.
- Screenshot: capture screen shots and save them to image files.
- Form1: form events and methods.

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.

How it works

It is not big project and it is well commented so let see:
- File:Desktops.cs class:Desktops map Win32 functions for desktop management and implement sample wrappers on them.
- File:Screenshot.cs class:Screenshot capture screenshots and save them to image files.
- File:Form1.cs class:Form1 contains form events and methods, use previous classes, create desktops and processes on them and switch between desktops.

Class Desktops:
- public static IntPtr DesktopCreate(string name)
- public static IntPtr DesktopOpen(string name)
- public static bool DesktopSwitch(string name)
- public static bool ProcessCreate(string name, string path, string args)
- …
Previous methods create open and switch desktops, also can create processes on desktops.

Read more: Codeproject

Posted via email from .NET Info

0 comments: