Using TaskDialogIndirect in C#
Posted
by Dennis Delimarsky
on Stack Overflow
See other posts from Stack Overflow
or by Dennis Delimarsky
Published on 2010-04-27T17:24:02Z
Indexed on
2010/04/27
17:33 UTC
Read the original article
Hit count: 372
I've been working for a while with the regular Windows Vista/7 TaskDialog for a while, and I wanted to add some additional functionality (like custom buttons and a footer), so I need to use TaskDialogIndirect.
Following the MSDN documentation for TaskDialogIndirect, I got this signature:
[DllImport("comctl32.dll",CharSet = CharSet.Unicode,EntryPoint="TaskDialogIndirect")]
static extern int TaskDialogIndirect (TASKDIALOGCONFIG pTaskConfig, out int pnButton, out int pnRadioButton, out bool pfVerificationFlagChecked);
The TASKDIALOGCONFIG class is shown below:
public class TASKDIALOGCONFIG
{
public UInt16 cbSize;
public IntPtr hwndParent;
public IntPtr hInstance;
public String dwFlags;
public String dwCommonButtons;
public IntPtr hMainIcon;
public String pszMainIcon;
public String pszMainInstruction;
public String pszContent;
public UInt16 cButtons;
public TASKDIALOG_BUTTON pButtons;
public int nDefaultButton;
public UInt16 cRadioButtons;
public TASKDIALOG_BUTTON pRadioButtons;
public int nDefaultRadioButton;
public String pszVerificationText;
public String pszExpandedInformation;
public String pszExpandedControlText;
public String pszCollapsedControlText;
public IntPtr hFooterIcon;
public IntPtr pszFooterText;
public String pszFooter;
// pfCallback;
// lpCallbackData;
public UInt16 cxWidth;
}
The TASKDIALOG_BUTTON implementation:
public class TASKDIALOG_BUTTON
{
public int nButtonID;
public String pszButtonText;
}
I am not entirely sure if I am on the right track here. Did anyone use TaskDialogIndirect from managed code directly through WinAPI (without VistaBridge or Windows API Code Pack)? I am curious about the possible implementations, as well as the callback declarations (I am not entirely sure how to implement TaskDialogCallbackProc).
PS: I am looking for a direct WinAPI implementation, not one through a wrapper.
© Stack Overflow or respective owner