共用方式為


CTaskDialog Class

A pop-up dialog box that functions like a message box but can display additional information to the user. The CTaskDialog also includes functionality for gathering information from the user.

class CTaskDialog : public CObject

Members

Constructors

CTaskDialog::CTaskDialog

Constructs a CTaskDialog object.

Methods

CTaskDialog::AddCommandControl

Adds a command button control to the CTaskDialog.

CTaskDialog::AddRadioButton

Adds a radio button to the CTaskDialog.

CTaskDialog::ClickCommandControl

Clicks a command button control or common button programmatically.

CTaskDialog::ClickRadioButton

Clicks a radio button programmatically.

CTaskDialog::DoModal

Displays the CTaskDialog.

CTaskDialog::GetCommonButtonCount

Retrieves the number of common buttons available.

CTaskDialog::GetCommonButtonFlag

Converts a standard Windows button to the common button type associated with the CTaskDialog class.

CTaskDialog::GetCommonButtonId

Converts one of the common button types associated with the CTaskDialog class to a standard Windows button.

CTaskDialog::GetOptions

Returns the option flags for this CTaskDialog.

CTaskDialog::GetSelectedCommandControlID

Returns the selected command button control.

CTaskDialog::GetSelectedRadioButtonID

Returns the selected radio button.

CTaskDialog::GetVerificationCheckboxState

Retrieves the state of the verification check box.

CTaskDialog::IsCommandControlEnabled

Determines whether a command button control or common button is enabled.

CTaskDialog::IsRadioButtonEnabled

Determines whether a radio button is enabled.

CTaskDialog::IsSupported

Determines whether the computer that is running the application supports the CTaskDialog.

CTaskDialog::LoadCommandControls

Adds command button controls by using data from the string table.

CTaskDialog::LoadRadioButtons

Adds radio buttons by using data from the string table.

CTaskDialog::NavigateTo

Transfers the focus to another CTaskDialog.

CTaskDialog::OnCommandControlClick

The framework calls this method when the user clicks a command button control.

CTaskDialog::OnCreate

The framework calls this method after it creates the CTaskDialog.

CTaskDialog::OnDestroy

The framework calls this method immediately before it destroys the CTaskDialog.

CTaskDialog::OnExpandButtonClick

The framework calls this method when the user clicks on the expansion button.

CTaskDialog::OnHelp

The framework calls this method when the user requests help.

CTaskDialog::OnHyperlinkClick

The framework calls this method when the user clicks on a hyperlink.

CTaskDialog::OnInit

The framework calls this method when the CTaskDialog is initialized.

CTaskDialog::OnNavigatePage

The framework calls this method when the user moves the focus with regard to controls on the CTaskDialog.

CTaskDialog::OnRadioButtonClick

The framework calls this method when the user selects a radio button control.

CTaskDialog::OnTimer

The framework calls this method when the timer expires.

CTaskDialog::OnVerificationCheckboxClick

The framework calls this method when the user clicks the verification check box.

CTaskDialog::RemoveAllCommandControls

Removes all the command controls from the CTaskDialog.

CTaskDialog::RemoveAllRadioButtons

Removes all the radio buttons from the CTaskDialog.

CTaskDialog::SetCommandControlOptions

Updates a command button control on the CTaskDialog.

CTaskDialog::SetCommonButtonOptions

Updates a subset of common buttons to be enabled and require UAC elevation.

CTaskDialog::SetCommonButtons

Adds common buttons to the CTaskDialog.

CTaskDialog::SetContent

Updates the content of the CTaskDialog.

CTaskDialog::SetDefaultCommandControl

Specifies the default command button control.

CTaskDialog::SetDefaultRadioButton

Specifies the default radio button.

CTaskDialog::SetDialogWidth

Adjusts the width of the CTaskDialog.

CTaskDialog::SetExpansionArea

Updates the expansion area of the CTaskDialog.

CTaskDialog::SetFooterIcon

Updates the footer icon for the CTaskDialog.

CTaskDialog::SetFooterText

Updates the text on the footer of the CTaskDialog.

CTaskDialog::SetMainIcon

Updates the main icon of the CTaskDialog.

CTaskDialog::SetMainInstruction

Updates the main instruction of the CTaskDialog.

CTaskDialog::SetOptions

Configures the options for the CTaskDialog.

CTaskDialog::SetProgressBarMarquee

Configures a marquee bar for the CTaskDialog and adds it to the dialog box.

CTaskDialog::SetProgressBarPosition

Adjusts the position of the progress bar.

CTaskDialog::SetProgressBarRange

Adjusts the range of the progress bar.

CTaskDialog::SetProgressBarState

Sets the state of the progress bar and displays it on the CTaskDialog.

CTaskDialog::SetRadioButtonOptions

Enables or disables a radio button.

CTaskDialog::SetVerificationCheckbox

Sets the checked state of the verification check box.

CTaskDialog::SetVerificationCheckboxText

Sets the text on the right side of the verification check box.

CTaskDialog::SetWindowTitle

Sets the title of the CTaskDialog.

CTaskDialog::ShowDialog

Creates and displays a CTaskDialog.

CTaskDialog::TaskDialogCallback

The framework calls this in response to various Windows messages.

Data Members

m_aButtons

The array of command button controls for the CTaskDialog.

m_aRadioButtons

The array of radio button controls for the CTaskDialog.

m_bVerified

TRUE indicates the verification check box is checked; FALSE indicates it is not.

m_footerIcon

The icon in the footer of the CTaskDialog.

m_hWnd

A handle to the window for the CTaskDialog.

m_mainIcon

The main icon of the CTaskDialog.

m_nButtonDisabled

A mask that indicates which of the common buttons are disabled.

m_nButtonElevation

A mask that indicates which of the common buttons require UAC elevation.

m_nButtonId

The ID of the selected command button control.

m_nCommonButton

A mask that indicates which common buttons are displayed on the CTaskDialog.

m_nDefaultCommandControl

The ID of the command button control that is selected when the CTaskDialog is displayed. 

m_nDefaultRadioButton

The ID of the radio button control that is selected when the CTaskDialog is displayed.

m_nFlags

A mask that indicates the options for the CTaskDialog.

m_nProgressPos

The current position for the progress bar. This value must be between m_nProgressRangeMin and m_nProgressRangeMax.

m_nProgressRangeMax

The maximum value for the progress bar.

m_nProgressRangeMin

The minimum value for the progress bar.

m_nProgressState

The state of the progress bar. For more information, see CTaskDialog::SetProgressBarState.

m_nRadioId

The ID of the selected radio button control.

m_nWidth

The width of the CTaskDialog in pixels.

m_strCollapse

The string the CTaskDialog displays to the right of the expansion box when the expanded information is hidden.

m_strContent

The content string of the CTaskDialog.

m_strExpand

The string the CTaskDialog displays to the right of the expansion box when the expanded information is displayed.

m_strFooter

The footer of the CTaskDialog.

m_strInformation

The expanded information for the CTaskDialog.

m_strMainInstruction

The main instruction of the CTaskDialog.

m_strTitle

The title of the CTaskDialog.

m_strVerification

The string that the CTaskDialog displays to the right of the verification check box.

Remarks

The CTaskDialog class replaces the standard Windows message box and has additional functionality such as new controls to gather information from the user. This class is in the MFC library in Visual Studio 2010. The CTaskDialog is available starting with Windows Vista. Earlier versions of Windows cannot display the CTaskDialog object. Use CTaskDialog::IsSupported to determine at runtime whether the current user can display the task dialog box. The standard Windows message box is still supported in Visual Studio 2010.

The CTaskDialog is available only when you build your application by using the Unicode library.

The CTaskDialog has two different constructors. One constructor enables you to specify two command buttons and a maximum of six regular button controls. You can add more command buttons after you create the CTaskDialog. The second constructor does not support any command buttons, but you can add an unlimited number of regular button controls. For more information about the constructors, see CTaskDialog::CTaskDialog.

The following image shows a sample CTaskDialog to illustrate the location of some of the controls.

CTaskDialog Sample

A sample CTaskDialog

Requirements

Minimum required operating system: Windows Vista

Header: afxtaskdialog.h

See Also

Tasks

Walkthrough: Adding a CTaskDialog to an Application

Reference

CObject Class

Hierarchy Chart

Other Resources

MFC Classes