bright, fresh software
Downloads  |  Buy

Wyatt Says...

2 months ago we released wyBuild & wyUpdate v2.5. This release adds a free automatic updater control for C# & VB.NET apps. And because we wanted to keep things simple we left the wyUpdate.exe to do all the hard work (checking, download, installing) in the background while the AutomaticUpdater control is visible on your app’s main form.

We wanted the AutomaticUpdater to be able to control the update steps, view progress, and cancel the updating. But we also wanted to keep all the updating logic in the wyUpdate.exe. For this to be successful we needed a way for the AutomaticUpdater control to talk to wyUpdate.exe while it’s running.

The Answer: Inter-process communication (IPC)

Inter-Process communication is a fancy computer science way of saying “processes that can talk to each other”. Google Chrome uses IPC to communicate between tabs of the browser & plugins. It’s a simple way to keep parts of your program isolated from crashes.

For instance, if a tab of Google Chrome crashes only that single tab is killed. The rest of your tabs will continue to function normally.

Lots of bad ways to do IPC

Now that you know what inter-process communication is, let me tell you the worst ways to do it.

  • Shared memory: Difficult to set up & difficult to manage.
  • Shared files / registry: Very slow due to the writing & reading to/from disk. Difficult to manage.
  • SendMessage / PostMessage: Locks up the UI thread while the message is processed. Messages are limited to integer values. Can’t communicate from a non-admin process to an admin process. Assumes that your processes have a window.

Named Pipes

Inter process communication using named pipes is what Google Chrome uses and what we use for wyUpdate and the AutomaticUpdater control. Let me teach you about named pipes.

“Like Mario’s pipes?”

Exactly like Mario’s pipes. Except, instead of jumping Mario through the pipe, you push data through the pipe:

What do you put in the pipe?

You can transfer any data between your processes. So what data should your transfer? The answer is “it depends”. The rule of thumb is to keep it short, and keep it simple. Here’s what we do with the named pipe between wyUpdate and the AutomaticUpdater control sitting on your application:

  • Command codes: The AutomaticUpdater can command wyUpdate to check for updates, download the updates, extract the update, and install the update, or cancel any current progress.
  • Responses: wyUpdate can tell the AutomaticUpdater if there’s an update available, what changes there are in the update, and the progress of the current step (e.g. downloading).

With this simple setup the AutomaticUpdater control that’s on your application is completely isolated from wyUpdate.

Get the C# source

Download the named pipes C# source. It works with .NET 2.0, 3.0, 3.5 on Windows 2000 – Windows 7.

There are two files that do all the work: PipeServer.cs and PipeClient.cs. We use the PipeServer.cs file inside wyUpdate, and we use the PipeClient.cs file inside the AutomaticUpdater control.

Also included in the zip file is a simple messaging program to demonstrate communication between two separate processes:

Tell me what you think in the comments. I want to hear from you.

This is another easy tip to wrap up this series of articles.

Keyboard accessibility

Start your application and unplug your mouse. Can you navigate and use your application? If you hit the tab key does the next logical control get focused? Can you open the file menu by pressing Alt-F?

Set tab ordering

Simply set the “TabIndex” property of your controls in ascending starting with 0. This way when your users press the tab key they next focused control is the next control in the flow of your form.

Menu quick keys

To add “quick key” ability to your menus you just need to put an ampersand (“&”) before the letter that will be used for quick access. For example, instead of a menu item captioned “File”, caption it “&File” instead. Now your users can access that menu quickly by pressing Alt-F.

SystemStyle Buttons, Radio Buttons, and Checkboxes

In Windows Vista Microsoft changed the buttons, radio buttons, and checkboxes to have subtle animations. When you hover, check, and click these controls they all yield organic animations. But if you built your app using Windows Forms the subtle animations aren’t there.

To add these animations all you have to do is set the “FlatStyle” of these controls to “System”.

Windows UX Guide

Microsoft has assembled a great collection of guidelines for designing applications. It’s filled with screenshot examples showing good & bad designs. Plus it’s surprising self deprecating – some of their examples of bad design are screenshots taken directly from Microsoft apps.

You should skim the guide at least once and bookmark it for later.

7 Days of Windows 7

That’s it for the series. If you missed the earlier articles you can see the full list of articles in the series.

There are many Windows 7 controls already out there. I’ve included the best open source .NET components available. If you have other great controls, add them to the comments.

For each control I’ll list what versions of .NET it compiles for and what versions of Windows it will run on.

Windows Ribbon for Windows Forms

Arik Poznanski has a great series of posts about the ribbon control he wrote that wraps the Windows 7 API.

Download it now – full source code & examples. Also, view his series of articles (9 of them as of today).
Works with: Windows Forms (.NET 2.0, .NET 3.0, .NET 3.5)
Windows Versions: Only Windows 7

Windows API Code Pack for Microsoft .NET Framework

This is a mammoth control collection that is the work of 3 people.

Here are the major features:

  • Windows 7 Taskbar Jump Lists, Icon Overlay, Progress Bar, Tabbed Thumbnails, and Thumbnail Toolbars.
  • Windows 7 Libraries, Known Folders, non-file system containers.
  • Windows Shell Search API support, a hierarchy of Shell Namespace entities, and Drag and Drop functionality for Shell Objects.
  • Explorer Browser Control.
  • Shell property system.
  • Windows Vista and Windows 7 Common File Dialogs, including custom controls.
  • Windows Vista and Windows 7 Task Dialogs.
  • Direct3D 11.0, Direct3D 10.1/10.0, DXGI 1.0/1.1, Direct2D 1.0, DirectWrite, Windows Imaging Component (WIC) APIs. (DirectWrite and WIC have partial support)
  • Sensor Platform APIs
  • Extended Linguistic Services APIs
  • Power Management APIs
  • Application Restart and Recovery APIs
  • Network List Manager APIs
  • Command Link control and System defined Shell icons.

Download it now – full source code & examples.
Compiles with: Windows Forms (.NET 3.5) & Windows Presentation Foundation (WPF)
Windows Versions: Windows Vista & Windows 7

Windows 7 Progress Bar

Windows 7 Progress Bar is an open source progress bar component that allows you to add a progress bar to your program’s taskbar button. In addition, you can control the different states of the progress bar (normal, error, and paused) for Vista & Windows 7.

Download it now – full source code & examples.
Compiles with: Windows Forms (.NET 2.0, .NET 3.0, .NET 3.5)
Windows Versions: Windows 98, Windows 2000, Windows XP, Windows Vista, Windows 7

VistaMenu

VistaMenu is a menu component that allows you to add Windows 7 and Windows Vista-style menus with icons to your program. It’s written in C# and works with all .NET languages.

Download it now – full source code & examples.
Compiles with: Windows Forms (.NET 2.0, .NET 3.0, .NET 3.5)
Windows Versions: Windows 98, Windows 2000, Windows XP, Windows Vista, Windows 7

SplitButton

SplitButton is a button control with a region that shows a context menu when clicked. It’s written in C# and works with all .NET languages.

Download it now – full source code & examples.
Compiles with: Windows Forms (.NET 2.0, .NET 3.0, .NET 3.5)
Windows Versions: Windows 98, Windows 2000, Windows XP, Windows Vista, Windows 7

LinkLabel2

LinkLabel2 is a fixed version of the Windows.Forms LinkLabel control. It features the correct system “hand” cursor, and correct font rendering.

Download it now – full source code & examples.
Compiles with: Windows Forms (.NET 2.0, .NET 3.0, .NET 3.5)
Windows Versions: Windows 98, Windows 2000, Windows XP, Windows Vista, Windows 7

7 Days of Windows 7

Join me tomorrow when I talk about Finishing touches: Make your .NET app shine with professionalism. See the full list of articles in the series.