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();
Constructor for the CTaskDialog.TASKDIALOGCONFIG GetConfig() const;Returns the TASKDIALOGCONFIG structure for the Task Dialog.
TASKDIALOG_FLAGS GetOptions() const;Returns the Task Dialog's options.
int GetSelectedButtonID() const;Returns the ID of the selected button.
int GetSelectedRadioButtonID() const;Returns the ID of the selected radio button.
BOOL GetVerificationCheckboxState() const;Returns the state of the verification check box.
static BOOL IsSupported();Returns true if TaskDialogs are supported on this system.
void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons);Sets the common buttons for the task dialog.
void SetContent(LPCTSTR pszContent);Sets the task dialog's primary content.
void SetDefaultButton(int nButtonID);Sets the task dialog's default button.
void SetDefaultRadioButton(int nRadioButtonID);Sets the default radio button.
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.
void SetExpansionArea(LPCTSTR pszExpandedInfo, LPCTSTR pszExpandedLabel = _T(""), LPCTSTR pszCollapsedLabel = _T(""));Sets the text in the expandable area of the Task Dialog.
void SetFooterIcon(HICON hFooterIcon);
void SetFooterIcon(LPCTSTR lpszFooterIcon);Sets the icon that will be displayed in the Task Dialog's footer.
void SetFooterText(LPCTSTR pszFooter);Sets the text that will be displayed in the Task Dialog's footer.
void SetMainIcon(HICON hMainIcon);
void SetMainIcon(LPCTSTR lpszMainIcon);Sets Task Dialog's main icon.
void SetMainInstruction(LPCTSTR pszMainInstruction);Sets the Task Dialog's main instruction text.
void SetOptions(TASKDIALOG_FLAGS dwFlags);Sets the Task Dialog's options.
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.
void SetProgressBarPosition(int nProgressPos);Sets the current position for a progress bar.
void SetProgressBarRange(int nMinRange, int nMaxRange);Sets the minimum and maximum values for the hosted progress bar.
void SetProgressBarState(int nNewState = PBST_NORMAL);Sets the current state of the progress bar.
void SetVerificationCheckbox(BOOL bChecked);Simulates a click on the verification checkbox of the Task Dialog, if it exists.
void SetVerificationCheckboxText(LPCTSTR pszVerificationText);Sets the text for the verification check box.
void SetWindowTitle(LPCTSTR pszWindowTitle);Sets the Task Dialog's window title.
void AddCommandControl(int nButtonID, LPCTSTR pszCaption);Adds a command control or push button to the Task Dialog.
void AddRadioButton(int nRadioButtonID, LPCTSTR pszCaption);Adds a radio button to the Task Dialog.
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.
void ClickButton(int nButtonID) const;Simulates the action of a button click in the Task Dialog.
void ClickRadioButton(int nRadioButtonID) const;Simulates the action of a radio button click in the TaskDialog.
LRESULT DoModal(CWnd* pParent = NULL);Creates and displays the Task Dialog.
void ElevateButton(int nButtonID, BOOL bElevated);Adds a shield icon to indicate that the button's action requires elevated privilages.
void EnableButton(int nButtonID, BOOL bEnabled);Enables or disables a push button in the TaskDialog.
void EnableRadioButton(int nButtonID, BOOL bEnabled);Enables or disables a radio button in the TaskDialog.
void NavigateTo(CTaskDialog& TaskDialog) const;Replaces the information displayed by the task dialog.
void RemoveAllButtons();Removes all push buttons from the task dialog.
void RemoveAllRadioButtons();Removes all radio buttons from the task dialog.
void Reset();Returns the dialog to its default state.
void UpdateElementText(TASKDIALOG_ELEMENTS eElement, LPCTSTR pszNewText);Updates a text element on the Task Dialog.
virtual BOOL OnTDButtonClicked(int nButtonID);Called when the user selects a button or command link.
virtual void OnTDConstructed();Called when the task dialog is constructed, before it is displayed.
virtual void OnTDCreated();Called when the task dialog is displayed.
virtual void OnTDDestroyed();Called when the task dialog is destroyed.
virtual void OnTDExpandButtonClicked(BOOL bExpanded);Called when the expand button is clicked.
virtual void OnTDHelp();Called when the user presses F1 on the keyboard.
virtual void OnTDHyperlinkClicked(LPCTSTR pszHref);Called when the user clicks on a hyperlink.
virtual void OnTDNavigatePage();Called when a navigation has occurred.
virtual BOOL OnTDRadioButtonClicked(int nRadioButtonID);Called when the user selects a radio button.
virtual void OnTDTimer(DWORD dwTickCount);Called every 200 milliseconds (aproximately) when the TDF_CALLBACK_TIMER flag is set.
virtual void OnTDVerificationCheckboxClicked(BOOL bChecked);Called when the user clicks the Task Dialog verification check box.
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 |