TaskDialog (comctl32)
Last changed: -72.24.140.51

.
Summary
TaskDialog - Show a Windows Vista Task Dialog - like messagebox but much much better.

C# Signature:

[DllImport("comctl32.dll", CharSet = CharSet.Unicode,  EntryPoint="TaskDialog")]
static extern int TaskDialog(IntPtr hWndParent, IntPtr hInstance, String pszWindowTitle, String pszMainInstruction, String pszContent, int dwCommonButtons, IntPtr pszIcon, out int pnButton);

VB Signature:

Public Declare Auto Function TaskDialog Lib "comctl32.dll" (ByVal hWnd As IntPtr, ByVal hInstance As IntPtr, ByVal WindowTitle As String, ByVal MainInstruction As String, ByVal Content As String, ByVal CommonButton As Integer, ByVal DialogIcon As Integer, ByRef PushedButton As Integer) As Integer

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

It only works with forms applications, wpf applications give a entry point not found exception.

To make it work with wpf applications you need to add the following to your app.manifest under asmv1:assembly

  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
            processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
    </dependentAssembly>
  </dependency>

For WPF:

This only appears to be an issue with VS2008, and it may have been fixed by the time you are reading this, so try to run the project first, and if you click on one of the 'TaskDialog' buttons and see it popup (ie you dont see an exception) then you do not need to take these steps, if you do get an exception, follow the steps below:

To Run the VistaBridge Project in Visual Studio 2008, you must re-create the Application Manifest file. To do this, open the manifest already in the project, copy all of the text from it to notepad and then delete the manifest file from the project. Next, right click on the "VistaBridgeDemoApp" project and select Add New Item. Choose an Application Manifest File and MAKE SURE you name it as follows: VistaBridgeDemoApp.exe.manifest and then press enter. Now double click on the new manifest file, select all the text and replace it with the text that was copied out of the old manifest. You can now Build the solution and the Demo App should now operate properly. If you still have problems, try closing Visual Studio and then Re-opening it.

Sample Code:

Please add some!

Documentation
TaskDialog on MSDN Kundan