Writing a virtual desktop system in C# with WinAPI

The virtual desktop system is an interesting feature that attempts to bring the massive benefits of multi-monitor computers to single-monitor people. With a simple key combo or button click, the screen is split into a tiled grid of several desktops in an Exposé (now called Mission Control)-type fashion with the ability to select one and switch to it (see fig. 1).

Virtual desktops on Windows (Sysinternals Desktops 2.0)
(Fig. 1) Here is a an example desktop switching “pager” called “Desktops” by Sysinternals running on my Windows 7 machine.

For all intents and purposes, a virtual desktop is treated like another physical monitor, giving you a tremendous amount of “screen space” to work with. This is excellent for developers or graphic artists whose careers require many programs to be up and running simultaneously but cannot use a multi-monitor system, whether it be due to high costs or space constraints of some kind.

When people think of virtual desktops, thoughts of Linux, Mac, and BSD come to mind, but never Windows! Believe it or not, the WinAPI does have full virtual desktop support (as shown by the screen that appears when you press CTRL+ALT+DEL), but Microsoft does not implement it in a user-accessible way. This tutorial will detail how to get access to it and embed it in your own application. So let’s get cracking!

Read more

uShell Advances… if Slowly

µShell Desktop Screenshot
A screenshot of the latest µShell build (as of this writing).

My hobby shell replacement project, µShell, is improving a lot. It is still far from being finished, and it has a few glitches, but it is still a useable, but limited, shell replacement.

Originally, I was seriously concerened with its high memory usage, but I realized that it seemed to run slowly only because it was being compiled and executed from my USB backup drive. After unplugging the drive and executing the program from my desktop, it ran like a dream. Lately, I have managed to implement some new features during the past few months:

  • A proof-of-concept taskbar. It currently has only two functional buttons:
    1. iTunes Hide: This button will check to see if iTunes is running. If it is, it will hide it.
    2. iTunes Show: The exact opposite of the other button. I’m sure you can guess what it does.
  • Filled the code up to the brim with useful comments. You don’t really need extensive documentation (you will need to read the SOURCEMAP file, though) as the comments serve this purpose well enough.
  • Improved the looks of the program (added translucency and new icons from the Elementary Project’s icon set for Linux).
  • The beginnings of a unified settings manager. It barely has any controls on it, but it’s starting to make use of C#’s Properties.Settings.Default plumbing under the hood. There is still much room for improvement, though.
  • Virtual Desktops! It took me so long to implement this. I feel my head gained weight with all of that reading. It is still limited, though: it only supports two desktops, and there seems to be a severe glitch where µShell doesn’t always start on the second desktop, so when you switch to the second one, you are stuck there.

I understand this shell may be sub-par in its present state, but please remember that although I have been working on it since 2010 (not counting the VB 2008 “Altershell” prototype made in 2009), but only one to six hours a day and with five-month breaks in between. I believe that if I could find a way to effectively juggle high school, summer camps, and my free time, I could really exploit its potential and make something great out of it.

If you wish, please check out my new YouTube video that I have uploaded, which showcases the latest nightly Git build of µShell, which can be found here. Also, if you wish to see the three new & recently added shell screenshots, you can find them in the Pictures page.

Sorry that this post is kind of short in comparison to others (or maybe you are happy that it isn’t a big lecture), but I just wanted to promote my project a bit, after so many long months of no status updates.

Better WPF tab controls, anyone?

As my first post (w00t!), I’d like to give a shout out (and hopefully direct some traffic) to a great project going on at CodePlex for some time now: FabTab. These guys have been developing a wonderful replacement for the stock WPF tab control for some time now, and since I like to use it, I thought this would be a nice first post to repay them. It’s got tons of improvements, including a built-in “Close tab” button, an Internet Explorer-esque “QuickTab” capability, a tab list, real-time pop-up thumbnails, badass animations when switching between tabs, drag-and-drop tab reordering, and lots more. I’ve been using it for a while and I love it!

If that sounds pretty good to you, and you’d like to learn more or download this library (as a *.dll to link with your application), you can get it at their project page at CodePlex. Below is a screenshot of the example program in action, and it’s pretty epic.

Anyway, I think that the FabTab library is great, and I give major props to the devs. 🙂