CTaskDialog

Win32++

CTaskDialog Class

Description

The CTaskDialog class is used to create Task Dialogs.A task dialog is a dialog box that can be used to display information and receive simple input from the user. Like a message box, it is formatted by the operating system according to parameters you set. However, a task dialog has many more features than a message box.

CTaskDialog Members

Construction
CTaskDialog
CTaskDialog();
Constructor for the CTaskDialog. Attributes GetConfig
TASKDIALOGCONFIG GetConfig() const;
Returns the TASKDIALOGCONFIG structure for the Task Dialog. GetOptions
TASKDIALOG_FLAGS GetOptions() const;
Returns the Task Dialog's options. GetSelectedButtonID
int GetSelectedButtonID() const;
Returns the ID of the selected button. GetSelectedRadioButtonID
int GetSelectedRadioButtonID() const;
Returns the ID of the selected radio button. GetVerificationCheckboxState
BOOL GetVerificationCheckboxState() const;
Returns the state of the verification check box. IsSupported
static BOOL IsSupported();
Returns true if TaskDialogs are supported on this system. SetCommonButtons
void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons);
Sets the common buttons for the task dialog. SetContent
void SetContent(LPCTSTR pszContent);
Sets the task dialog's primary content. SetDefaultButton
void SetDefaultButton(int nButtonID);
Sets the task dialog's default button. SetDefaultRadioButton
void SetDefaultRadioButton(int nRadioButtonID);
Sets the default radio button. SetDialogWidth
void SetDialogWidth(UINT nWidth = 0);
The width of the task dialog's client area. If 0, the task dialog manager will calculate the ideal width. SetExpansionArea
void SetExpansionArea(LPCTSTR pszExpandedInfo, LPCTSTR pszExpandedLabel = _T(""), 
                      LPCTSTR pszCollapsedLabel = _T(""));
Sets the text in the expandable area of the Task Dialog. SetFooterIcon
void SetFooterIcon(HICON hFooterIcon);
void SetFooterIcon(LPCTSTR lpszFooterIcon);
Sets the icon that will be displayed in the Task Dialog's footer. SetFooterText
void SetFooterText(LPCTSTR pszFooter);
Sets the text that will be displayed in the Task Dialog's footer. SetMainIcon
void SetMainIcon(HICON hMainIcon);
void SetMainIcon(LPCTSTR lpszMainIcon);
Sets Task Dialog's main icon. SetMainInstruction
void SetMainInstruction(LPCTSTR pszMainInstruction);
Sets the Task Dialog's main instruction text. SetOptions
void SetOptions(TASKDIALOG_FLAGS dwFlags);
Sets the Task Dialog's options. SetProgressBarMarquee
void SetProgressBarMarquee(BOOL bEnabled = TRUE, int nMarqueeSpeed = 0);
Starts and stops the marquee display of the progress bar, and sets the speed of the marquee. SetProgressBarPosition
void SetProgressBarPosition(int nProgressPos);
Sets the current position for a progress bar. SetProgressBarRange
void SetProgressBarRange(int nMinRange, int nMaxRange);
Sets the minimum and maximum values for the hosted progress bar. SetProgressBarState
void SetProgressBarState(int nNewState = PBST_NORMAL);
Sets the current state of the progress bar. SetVerificationCheckbox
void SetVerificationCheckbox(BOOL bChecked);
Simulates a click on the verification checkbox of the Task Dialog, if it exists. SetVerificationCheckboxText
void SetVerificationCheckboxText(LPCTSTR pszVerificationText);
Sets the text for the verification check box. SetWindowTitle
void SetWindowTitle(LPCTSTR pszWindowTitle);
Sets the Task Dialog's window title. Operations AddCommandControl
void AddCommandControl(int nButtonID, LPCTSTR pszCaption);
Adds a command control or push button to the Task Dialog. AddRadioButton
void AddRadioButton(int nRadioButtonID, LPCTSTR pszCaption);
Adds a radio button to the Task Dialog. AddRadioButtonGroup
void AddRadioButtonGroup(int nIDRadioButtonsFirst, int nIDRadioButtonsLast);
Adds a range of radio buttons to the Task Dialog. The resource ID of the button and it's string must match. ClickButton
void ClickButton(int nButtonID) const;
Simulates the action of a button click in the Task Dialog. ClickRadioButton
void ClickRadioButton(int nRadioButtonID) const;
Simulates the action of a radio button click in the TaskDialog. DoModal
LRESULT DoModal(CWnd* pParent = NULL);
Creates and displays the Task Dialog. ElevateButton
void ElevateButton(int nButtonID, BOOL bElevated);
Adds a shield icon to indicate that the button's action requires elevated privilages. EnableButton
void EnableButton(int nButtonID, BOOL bEnabled);
Enables or disables a push button in the TaskDialog. EnableRadioButton
void EnableRadioButton(int nButtonID, BOOL bEnabled);
Enables or disables a radio button in the TaskDialog. NavigateTo
void NavigateTo(CTaskDialog& TaskDialog) const;
Replaces the information displayed by the task dialog. RemoveAllButtons
void RemoveAllButtons();
Removes all push buttons from the task dialog. RemoveAllRadioButtons
void RemoveAllRadioButtons();
Removes all radio buttons from the task dialog. Reset
void Reset();
Returns the dialog to its default state. UpdateElementText
void UpdateElementText(TASKDIALOG_ELEMENTS eElement, LPCTSTR pszNewText);
Updates a text element on the Task Dialog. Overridables OnTDButtonClicked
virtual BOOL OnTDButtonClicked(int nButtonID);
Called when the user selects a button or command link. OnTDConstructed
virtual void OnTDConstructed();
Called when the task dialog is constructed, before it is displayed. OnTDCreated
virtual void OnTDCreated();
Called when the task dialog is displayed. OnTDDestroyed
virtual void OnTDDestroyed();
Called when the task dialog is destroyed. OnTDExpandButtonClicked
virtual void OnTDExpandButtonClicked(BOOL bExpanded);
Called when the expand button is clicked. OnTDHelp
virtual void OnTDHelp();
Called when the user presses F1 on the keyboard. OnTDHyperlinkClicked
virtual void OnTDHyperlinkClicked(LPCTSTR pszHref);
Called when the user clicks on a hyperlink. OnTDNavigatePage
virtual void OnTDNavigatePage();
Called when a navigation has occurred. OnTDRadioButtonClicked
virtual BOOL OnTDRadioButtonClicked(int nRadioButtonID);
Called when the user selects a radio button. OnTDTimer
virtual void OnTDTimer(DWORD dwTickCount);
Called every 200 milliseconds (aproximately) when the TDF_CALLBACK_TIMER flag is set. OnTDVerificationCheckboxClicked
virtual void OnTDVerificationCheckboxClicked(BOOL bChecked);
Called when the user clicks the Task Dialog verification check box. TaskDialogProc
virtual LRESULT TaskDialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
Override this function to specify how the messages for this window are to be handled. Return all unhandled messages to TaskDialogProcDefault.
Base class Members

For base class members, refer to the members of CWnd.

Remarks

Task dialogs require Windows Vista or above. They are not supported on Windows XP. The IsSupported function can be used to test if the operating system is capable of supporting task dialogs.

The following diagram illustrates the various components of a task dialog.

Summary Information

Header file taskdialog.h
Win32/64 support Yes
WinCE support No