Window 7 provides a very nice and managed task bar as compared to the previous versions of Windows. So, I used some new features like JumpList, TabbedThumbnail etc., introduced by Windows 7 in this application. With the help of these new features, Task Manager is a more interactive application. This article will explain how to use these features in the application and will also give teach you to use the ComboBox and DataGridView in an advanced manner.

Task Manager also has a separate version for those who do not have Windows 7.

Jump List

Task Manager provides an easy way to view/edit tasks using the Windows 7 jump list. You can easily set your jump list view using the Settings window of the Task Manager.

The Settings window provides you three ways to group your jump list, by Priority, Color Category, or Flag.

It is very easy to manage the Jump list using the Windows API Code Pack. Call the JumpList.CreateJumpList() method to create a jump list for your application.

JumpListLink gets the path of the application executable and its open windows on each click. But Task Manager opens an edit task window of the same application on a link click. You can achieve this functionality using a Mutex class. Mutex is used in a multi threaded environment for synchronization mechanisms to ensure that only one thread at a time uses a resource. The SingleInstanceChecker class checks the running instance of the application.

If SingleInstanceChecker sets IsSingle to false, it means the application is already running; handle it using the HandleJumpListCommand() method. If this event is because of a jump list item, then this method sends a window message to the TaskManagerMainForm form. TaskManagerMainForm handles this message by overriding the WndProc method to handle window messages.

Tabbed Thumbnail

You can easily navigate your incomplete tasks using Tabbed Thumbnail of Windows 7. The Task Manager provides allows you to move forward and back your tasks using the Thumbnail, and you can also edit/view your task details using an Edit button.

The Windows 7 API Code Pack also provides you an easy way to add Tabbed Thumbnail Preview. Just create a TabbedThumbnail object and add it using the TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview() method. You can also add buttons in it by using the ThumbnailToolbarButton class. Create an object of this class and add it to the thumbnail using the TaskbarManager.Instance.ThumbnailToolbars.AddButtons() method. Register the click event of the button for the appropriate action on button click.

Overlay Icon

Icon overlay is the best feature of Windows 7. You can easily see the state of an application with just one look at the task bar. Task Manager also shows two icons on the task bar: one for error and another for confirmation/question.

Gantt Chart

You can also see the Gantt view of your tasks in the Task Manager. This Gantt chart shows the day view only. The Gantt chart grid shows weekend days (Saturday, Sunday) cells in gray color and shows a green line for current day cells. You can see the busy days with a red bar and it also shows the tooltip with task detail on mouse over on a busy cell.

The GanttChart class is inherited from DataGridView because the Gantt chart view is like a grid. The GanttChart class overrides some methods of DataGridview to change the default behavior.

The OnCellPainting method executes for each cell drawing, and overrides the cell draw method according to its data and type. If the cell is a header, then it draws the day header, and if the cell is data, then the cell is drawn according to its data. The OnPaint method handles the drawing of the year header.

For adding an image to a combo box, you need to set the DrawMode of the combobox: DrawMode = DrawMode.OwnerDrawVariable. Then, you need to override the DrawItem event of the combo box where you can draw the item as you want.

Nice example good code. I like your profile comment. "I always try to be a better than I am and think positive for positive result." you are my man. Not many people have such attitude. I tell you brother, you will be happy for ever with this attitude.

which causes the window message to enter DispatchMessage in TaskbarWindowManager,
where it ends up at

if (!buttonsAdded)
AddButtons(taskbarWindow);

The problem is that all of the initialization is not complete when GetWindowText is called, the logic fails in TaskBarWindow.WindowToTellTaskbarAbout and it returns a
new IntPtr(), dooming all that follows.

(yes, this took a while to track down, so I don't blame the author)

The quickest fix that seems to work so far (CAUTION: I have NOT completely tested this, but it gets past the initial crash cause) is:

Modify TaskbarWindowManager.DispatchMessage, and insert at the very top a check for a WM_GETTEXT message (the int value is 13) and if it is, simply return false, signalling the window message was not handled.