Click here to Skip to main content
Click here to Skip to main content

TaskDialog via Windows API Code Pack for Microsoft .NET Framework

, 29 Aug 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Using the TaskDialog API as an attactive alternative to the standard windows MessageBox.

TaskDialog quick reference

I'm currently developing an application and I got so tired of looking at the same old MessageBox that I've been looking at for years and thought surely someone on CP has a better mouse trap. I found a few fairly decent solutions but then discovered that when Vista came out Microsoft included a very nifty TaskDialog control and provided an API but it was in unmanaged code. So I looked around a little more and
found an excellent article by KevinGre TaskDialog for WinFormsthat was basically a wrapper but when I tried to run it I had problems and as opposed to diving into old code (written in Jan 2007) I looked around for something more recent.

What I ran accoss is the Windows API Code Pack for Microsoft .NET Framework that included among a lot of other things a managed TaskDialog. So I download the code and included a reference in my code and followed the instructions that I had found on a couple of sites and when I ran it I got a "Unable to find an entry point name 'TaskDialogIndirect' in DLL 'comctl32.dll'" exception so it was back to google and it took quite a while but I found this article that proposed a trick that solved this problem and by gum it worked. In a nut shell this is what is needed to resolve the problem with the exception.

  • Open Project Properties
  • Go to Security Tab and click the Enable ClickOnce Security Settings don't
    close window yet
  • This will create an app.manifest file in the Properties solution folder.
  • Edit this file and under the </trustInfo> insert the code shown below.
  • Compile your soution, you will get an error
  • Go back to the ClickOnce option and deselect it.
  • Recompile your code. This time it will compile without errors and your code will
    run without exception.
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />

I was so glad to find that article and it really is nice to be able to interact with the user using the new TaskDialog. It is so much more flexible and easy to

As an added bonus during my googling I ran across this articledescribing some undocumented/hidden icons that are available for use in the TaskDialog.
The icon definitions are listed here;


























This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mike Hankey
United States United States
I'm an old assembler and C programmer self taught in the object oriented languages and Web design. Upon graduating from Murray State University in 1983 I Started doing embedded systems for the automotive industry, got a wild hair and moved to Florida in 1986 and did some work on DEC PDP and MicroVax computers.
My latest project:
ToDoManager extension for VS2010 and Atmel Studio 6.1

Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.1 | Last Updated 30 Aug 2011
Article Copyright 2011 by Mike Hankey
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid