Reminder for Win32 and C# desktop application developers: make sure you use your task bar icon as a progress bar when executing long-running operations
Posted: (EET/GMT+2)
If you are developing desktop applications with C# for Windows 7 or Windows 8, and your application executes long-running (background) operations, there's a great tip for you: remember to utilize the task bar icon features in the Windows operating system that allow you to display a progress bar.
If you have been downloading anything with Internet Explorer (IE), installed Visual Studio or burned a CD, DVD or Blu-Ray disc with ImgBurn, you have seen it: an (usually) green progress bar right in the task bar icon of the application in question. What a great idea!
Now, as a developer, how would you implement this neat, but highly useful little trick? For C# developers, you can use the framework class TaskbarItemInfo (available since .NET 4.0) and two properties: ProgressState and ProgressValue. This class lives in the System.Windows.Shell namespace.
For Win32 developers, the correct APIs can be found from the COM interface named ITaskbarList3. The COM interface doesn't support properties, so you must use the methods named SetProgressState and SetProgressValue.
A good C# sample application is provided by a fellow MVP on MSDN.
Hope this helps!