Share via


CTaskDialog クラス

メッセージ ボックスのような機能を持つだけでなく、ユーザーに対する追加情報も表示できる、ポップアップ ダイアログ ボックスです。 CTaskDialog には、ユーザーから情報を収集するための機能も用意されています。

構文

class CTaskDialog : public CObject

メンバー

コンストラクター

名前 説明
CTaskDialog::CTaskDialog CTaskDialog オブジェクトを構築します。

メソッド

Name 説明
CTaskDialog::AddCommandControl コマンド ボタン コントロールを CTaskDialog.
CTaskDialog::AddRadioButton ラジオ ボタンを追加します。CTaskDialog
CTaskDialog::ClickCommandControl コマンド ボタン コントロールまたは共通ボタンをプログラムでクリックします。
CTaskDialog::ClickRadioButton プログラムによってラジオ ボタンをクリックします。
CTaskDialog::D oModal CTaskDialog」を表示します。
CTaskDialog::GetCommonButtonCount 使用可能な一般的なボタンの数を取得します。
CTaskDialog::GetCommonButtonFlag 標準の Windows ボタンを、クラスに関連付けられている共通のボタン型に CTaskDialog 変換します。
CTaskDialog::GetCommonButtonId クラスに関連付けられている一般的なボタンの種類のいずれかを CTaskDialog 標準の Windows ボタンに変換します。
CTaskDialog::GetOptions この CTaskDialogオプション フラグを返します。
CTaskDialog::GetSelectedCommandControlID 選択したコマンド ボタン コントロールを返します。
CTaskDialog::GetSelectedRadioButtonID 選択したラジオ ボタンを返します。
CTaskDialog::GetVerificationCheckboxState 検証チェック ボックスの状態を取得します。
CTaskDialog::IsCommandControlEnabled コマンド ボタン コントロールと共通ボタンのどちらを有効にするかを指定します。
CTaskDialog::IsRadioButtonEnabled ラジオ ボタンが有効かどうかを判断します。
CTaskDialog::IsSupported アプリケーションを実行しているコンピューターでサポートされているかどうかを判断します CTaskDialog
CTaskDialog::LoadCommandControls 文字列テーブルのデータを使用して、コマンド ボタン コントロールを追加します。
CTaskDialog::LoadRadioButtons 文字列テーブルのデータを使用してラジオ ボタンを追加します。
CTaskDialog::NavigateTo フォーカスを別 CTaskDialogのフォーカスに転送します。
CTaskDialog::OnCommandControlClick フレームワークは、ユーザーがコマンド ボタン コントロールをクリックすると、このメソッドを呼び出します。
CTaskDialog::OnCreate フレームワークは、作成後にこのメソッドを呼び出します CTaskDialog
CTaskDialog::OnDestroy フレームワークは、このメソッドを破棄する直前に呼び出します CTaskDialog
CTaskDialog::OnExpandButtonClick フレームワークは、ユーザーが展開ボタンをクリックすると、このメソッドを呼び出します。
CTaskDialog::OnHelp フレームワークは、ユーザーがヘルプを要求したときにこのメソッドを呼び出します。
CTaskDialog::OnHyperlinkClick フレームワークは、ユーザーがハイパーリンクをクリックしたときにこのメソッドを呼び出します。
CTaskDialog::OnInit フレームワークは、初期化時にこのメソッドを CTaskDialog 呼び出します。
CTaskDialog::OnNavigatePage フレームワークは、ユーザーがコントロールに関してフォーカスを移動するときに、このメソッドを呼び出します。CTaskDialog
CTaskDialog::OnRadioButtonClick フレームワークは、ユーザーがラジオ ボタン コントロールを選択すると、このメソッドを呼び出します。
CTaskDialog::OnTimer フレームワークは、タイマーの有効期限が切れると、このメソッドを呼び出します。
CTaskDialog::OnVerificationCheckboxClick フレームワークは、ユーザーが検証チェック ボックスをクリックすると、このメソッドを呼び出します。
CTaskDialog::RemoveAllCommandControls からすべてのコマンド コントロールを削除します CTaskDialog
CTaskDialog::RemoveAllRadioButtons からすべてのラジオ ボタンを削除します CTaskDialog
CTaskDialog::SetCommandControlOptions のコマンド ボタン コントロールを更新しますCTaskDialog
CTaskDialog::SetCommonButtonOptions 更新一般的なボタンのサブセットを有効にし、UAC 昇格を必要とします。
CTaskDialog::SetCommonButtons 共通のボタンを追加します。CTaskDialog
CTaskDialog::SetContent の内容を更新しますCTaskDialog
CTaskDialog::SetDefaultCommandControl 既定のコマンド ボタン コントロールを指定します。
CTaskDialog::SetDefaultRadioButton 既定のラジオ ボタンを指定します。
CTaskDialog::SetDialogWidth の幅を調整します CTaskDialog
CTaskDialog::SetExpansionArea の拡張領域を更新しますCTaskDialog
CTaskDialog::SetFooterIcon のフッター アイコンを更新しますCTaskDialog
CTaskDialog::SetFooterText のフッターのテキストを更新しますCTaskDialog
CTaskDialog::SetMainIcon のメインアイコンを更新しますCTaskDialog
CTaskDialog::SetMainInstruction のメイン命令を更新しますCTaskDialog
CTaskDialog::SetOptions のオプションを構成します CTaskDialog
CTaskDialog::SetProgressBarMarquee マーキー バー CTaskDialog を構成し、ダイアログ ボックスに追加します。
CTaskDialog::SetProgressBarPosition 進行状況バーの位置を調整します。
CTaskDialog::SetProgressBarRange 進行状況バーの範囲を調整します。
CTaskDialog::SetProgressBarState 進行状況バーの状態を設定し、CTaskDialog
CTaskDialog::SetRadioButtonOptions ラジオ ボタンを有効または無効にします。
CTaskDialog::SetVerificationCheckbox 検証チェック ボックスのチェック状態を設定します。
CTaskDialog::SetVerificationCheckboxText 検証チェック ボックスの右側のテキストを設定します。
CTaskDialog::SetWindowTitle のタイトルを設定します CTaskDialog
CTaskDialog::ShowDialog を作成して表示します CTaskDialog
CTaskDialog::TaskDialogCallback フレームワークは、さまざまな Windows メッセージに応答してこれを呼び出します。

データ メンバー

名前 説明
m_aButtons のコマンド ボタン コントロールの CTaskDialog配列。
m_aRadioButtons のラジオ ボタン コントロールの CTaskDialog配列。
m_bVerified TRUEは、検証チェック ボックスがチェックされていることをFALSE示します。確認ボックスがチェックされていないことを示します。
m_footerIcon のフッターの CTaskDialogアイコン。
m_hWnd のウィンドウ CTaskDialogへのハンドル。
m_mainIcon のメイン アイコンCTaskDialog
m_nButtonDisabled 無効になっている一般的なボタンを示すマスク。
m_nButtonElevation UAC 昇格が必要な一般的なボタンを示すマスク。
m_nButtonId 選択したコマンド ボタン コントロールの ID。
m_nCommonButton に表示 CTaskDialogされる一般的なボタンを示すマスク。
m_nDefaultCommandControl 表示時に選択されるコマンド ボタン コントロールの CTaskDialog ID。
m_nDefaultRadioButton 表示時に選択されるラジオ ボタン コントロールの CTaskDialog ID。
m_nFlags のオプション CTaskDialogを示すマスク。
m_nProgressPos 進行状況バーの現在位置。 この値の有効値の範囲は m_nProgressRangeMinm_nProgressRangeMax です。
m_nProgressRangeMax 進行状況バーの最大値。
m_nProgressRangeMin 進行状況バーの最小値。
m_nProgressState 進行状況バーの状態。 詳細については、「 CTaskDialog::SetProgressBarState」を参照してください
m_nRadioId 選択したラジオ ボタン コントロールの ID。
m_nWidth ピクセル単位の CTaskDialog 幅。
m_strCollapse 展開された情報が CTaskDialog 非表示の場合に展開ボックスの右側に表示される文字列。
m_strContent のコンテンツ文字列 CTaskDialog
m_strExpand 展開された情報が CTaskDialog 表示されるときに展開ボックスの右側に表示される文字列。
m_strFooter のフッター CTaskDialog
m_strInformation の展開された情報 CTaskDialog
m_strMainInstruction のメイン命令CTaskDialog
m_strTitle のタイトル CTaskDialog
m_strVerification 検証チェック ボックスの右側に表示される文字列CTaskDialog

解説

このクラスは CTaskDialog 、標準の Windows メッセージ ボックスを置き換え、ユーザーから情報を収集するための新しいコントロールなどの追加機能を備えています。 このクラスは、Visual Studio 2010 以降の MFC ライブラリにあります。 Windows CTaskDialog Vista 以降で使用できます。 以前のバージョンの Windows では、オブジェクトを CTaskDialog 表示できません。 現在のユーザーがタスク ダイアログ ボックスを表示できるかどうかを実行時に確認するために使用 CTaskDialog::IsSupported します。 標準の Windows メッセージ ボックスは引き続きサポートされています。

これは CTaskDialog 、Unicode ライブラリを使用してアプリケーションをビルドする場合にのみ使用できます。

CTaskDialog 2 つの異なるコンストラクターがあります。 1 つのコンストラクターを使用すると、2 つのコマンド ボタンと最大 6 つの通常のボタン コントロールを指定できます。 を作成した後で、さらにコマンド ボタンを CTaskDialog追加できます。 2 番目のコンストラクターはコマンド ボタンをサポートしていませんが、通常のボタン コントロールを無制限に追加できます。 コンストラクターの詳細については、「CTaskDialog::CTaskDialog」を参照してください

次の図は、一部のコントロールの場所を示すサンプル CTaskDialog を示しています。

Example of CTaskDialog.
CTaskDialog サンプル

必要条件

最低限必要なオペレーティング システム: Windows Vista

ヘッダー: afxtaskdialog.h

CTaskDialog::AddCommandControl

新しいコマンド ボタン コントロールを追加します。CTaskDialog

void AddCommandControl(
    int nCommandControlID,
    const CString& strCaption,
    BOOL bEnabled = TRUE,
    BOOL bRequiresElevation = FALSE);

パラメーター

nCommandControlID
[in]コマンド コントロールの識別番号。

strCaption
[in]ユーザーに CTaskDialog 表示される文字列。 この文字列を使用して、コマンドの目的を説明します。

bEnabled
[in]新しいボタンが有効または無効になっているかどうかを示すブール型パラメーター。

bRequiresElevation
[in]コマンドに昇格が必要かどうかを示すブール型パラメーター。

解説

表示 CTaskDialog Class できるコマンド ボタン コントロールの数に制限はありません。 ただし、コマンド ボタン コントロールを CTaskDialog 表示する場合は、最大 6 つのボタンを表示できます。 コマンド CTaskDialog ボタン コントロールがない場合は、無制限の数のボタンを表示できます。

ユーザーがコマンド ボタン コントロールを選択すると、 CTaskDialog 閉じます。 アプリケーションで CTaskDialog::D oModal を使用してダイアログ ボックスを表示する場合は、DoModal選択したコマンド ボタン コントロールの nCommandControlID を返します。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::AddRadioButton

ラジオ ボタンを追加します。CTaskDialog

void CTaskDialog::AddRadioButton(
    int nRadioButtonID,
    const CString& strCaption,
    BOOL bEnabled = TRUE);

パラメーター

nRadioButtonID
[in]ラジオ ボタンの識別番号。

strCaption
[in]ラジオ ボタンの CTaskDialog 横に表示される文字列。

bEnabled
[in]ラジオ ボタンが有効かどうかを示すブール型パラメーター。

解説

CTaskDialog クラスラジオ ボタンを使用すると、ユーザーから情報を収集できます。 CTaskDialog::GetSelectedRadioButtonID 関数を使用して、選択されているラジオ ボタンを決定します。

nRadioButtonID CTaskDialog パラメーターがラジオ ボタンごとに一意である必要はありません。 ただし、ラジオ ボタンごとに個別の識別子を使用しないと、予期しない動作が発生する可能性があります。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::ClickCommandControl

コマンド ボタン コントロールまたは共通ボタンをプログラムでクリックします。

protected:
void ClickCommandControl(int nCommandControlID) const;

パラメーター

nCommandControlID
[in]クリックするコントロールのコマンド ID。

解説

このメソッドは、windows メッセージ TDM_CLICK_BUTTONを生成します。

CTaskDialog::ClickRadioButton

プログラムによってラジオ ボタンをクリックします。

protected:
void ClickRadioButton(int nRadioButtonID) const;

パラメーター

nRadioButtonID
[in]クリックするラジオ ボタンの ID。

解説

このメソッドは、windows メッセージ TDM_CLICK_RADIO_BUTTONを生成します。

CTaskDialog::CTaskDialog

CTaskDialog クラスのインスタンスを 作成します

CTaskDialog(
    const CString& strContent,
    const CString& strMainInstruction,
    const CString& strTitle,
    int nCommonButtons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON,
    int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
    const CString& strFooter = _T(""));

CTaskDialog(
    const CString& strContent,
    const CString& strMainInstruction,
    const CString& strTitle,
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast,
    int nCommonButtons,
    int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
    const CString& strFooter = _T(""));

パラメーター

strContent
[in]の内容 CTaskDialogに使用する文字列。

strMainInstruction
[in]のメイン命令CTaskDialog

strTitle
[in]のタイトル CTaskDialog

nCommonButtons
[in]に追加する一般的なボタンの CTaskDialogマスク。

nTaskDialogOptions
[in]に使用するオプションの CTaskDialogセット。

strFooter
[in]フッターとして使用する文字列。

nIDCommandControlsFirst
[in]最初のコマンドの文字列 ID。

nIDCommandControlsLast
[in]最後のコマンドの文字列 ID。

解説

アプリケーションに a を追加 CTaskDialog するには、2 つの方法があります。 最初の方法は、コンストラクターの 1 つを使用して、CTaskDialog::D oModal を使用してコンストラクターを作成CTaskDialogして表示することです。 2 つ目の方法は、静的関数 CTaskDialog::ShowDialog を使用することです。これにより、オブジェクトを明示的に作成せずに a CTaskDialogCTaskDialog 表示できます。

2 番目のコンストラクターは、アプリケーションのリソース ファイルのデータを使用してコマンド ボタン コントロールを作成します。 リソース ファイル内の文字列テーブルには、関連付けられた文字列 ID を持つ複数の文字列があります。 このメソッドは、nIDCommandControlsFirst と nCommandControlsLast の間の文字列テーブル内の有効な各エントリに対してコマンド ボタン コントロールを追加します。このコントロールを含めます。 これらのコマンド ボタン コントロールの場合、文字列テーブル内の文字列はコントロールのキャプションであり、文字列 ID はコントロールの ID です。

有効なオプションの一覧については、CTaskDialog::SetOptions を参照してください

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::D oModal

CTaskDialog 表示し、モーダルにします。

INT_PTR DoModal (HWND hParent = ::GetActiveWindow());

パラメーター

hParent
[in]の親ウィンドウ CTaskDialog

戻り値

ユーザーが行った選択に対応する整数。

解説

CTaskDialog のこのインスタンスを 表示します。 その後、アプリケーションはユーザーがダイアログ ボックスを閉じるのを待機します。

ユーザーが CTaskDialog 共通ボタン、コマンド リンク コントロール、または閉じると閉じます CTaskDialog。 戻り値は、ユーザーがダイアログ ボックスを閉じた方法を示す識別子です。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::GetCommonButtonCount

一般的なボタンの数を取得します。

int GetCommonButtonCount() const;

戻り値

使用可能な一般的なボタンの数。

解説

一般的なボタンは、CTaskDialog::CTaskDialog に指定する既定のボタンです。 CTaskDialog クラス、ダイアログ ボックスの下部にボタンを表示します。

ボタンの列挙リストは、CommCtrl.h で提供されています。

CTaskDialog::GetCommonButtonFlag

標準の Windows ボタンを、CTaskDialog クラスに関連付けられている共通のボタンの種類に 変換します

int GetCommonButtonFlag(int nButtonId) const;

パラメーター

nButtonId
[in]標準の Windows ボタンの値。

戻り値

対応する CTaskDialog 共通ボタンの値。 対応する共通ボタンがない場合、このメソッドは 0 を返します。

CTaskDialog::GetCommonButtonId

CTaskDialog クラスに関連付けられている一般的なボタンの種類のいずれかを標準の Windows ボタンに変換します。

int GetCommonButtonId(int nFlag);

パラメーター

nFlag
[in]クラスに関連付けられている共通のボタン型 CTaskDialog

戻り値

対応する標準の Windows ボタンの値。 対応する Windows ボタンがない場合、メソッドは 0 を返します。

CTaskDialog::GetOptions

この CTaskDialogオプション フラグを返します。

int GetOptions() const;

戻り値

のフラグ CTaskDialog

解説

CTaskDialog クラスで使用できるオプションの詳細については、「CTaskDialog::SetOptions」を参照してください

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::GetSelectedCommandControlID

選択したコマンド ボタン コントロールを返します。

int GetSelectedCommandControlID() const;

戻り値

現在選択されているコマンド ボタン コントロールの ID。

解説

このメソッドを使用して、ユーザーが選択したコマンド ボタンの ID を取得する必要はありません。 この ID は、CTaskDialog::D oModal または CTaskDialog::ShowDialog によって返されます。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::GetSelectedRadioButtonID

選択したラジオ ボタンを返します。

int GetSelectedRadioButtonID() const;

戻り値

選択したラジオ ボタンの ID。

解説

このメソッドは、ユーザーがダイアログ ボックスを閉じて、選択したラジオ ボタンを取得した後で使用できます。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::GetVerificationCheckboxState

検証チェック ボックスの状態を取得します。

BOOL GetVerificationCheckboxState() const;

戻り値

チェック ボックスがチェックされている場合は TRUE、そうでない場合は FAL Standard Edition。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::IsCommandControlEnabled

コマンド ボタン コントロールまたはボタンが有効かどうかを指定します。

BOOL IsCommandControlEnabled(int nCommandControlID) const;

パラメーター

nCommandControlID
[in]テストするコマンド ボタン コントロールまたはボタンの ID。

戻り値

コントロールが有効な場合は TRUE、無効な場合は FAL Standard Edition。

解説

このメソッドを使用して、コマンド ボタン コントロールと Class* の共通ボタンの両方の可用性を CTaskDialog 判断できます。

nCommandControlID が共通CTaskDialogボタンまたはコマンド ボタン コントロールの有効な識別子でない場合、このメソッドは例外をスローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::IsRadioButtonEnabled

ラジオ ボタンが有効かどうかを判断します。

BOOL IsRadioButtonEnabled(int nRadioButtonID) const;

パラメーター

nRadioButtonID
[in]テストするラジオ ボタンの ID。

戻り値

ラジオ ボタンが有効な場合は TRUE、無効な場合は FAL Standard Edition。

解説

nRadioButtonID がラジオ ボタンの有効な識別子でない場合、このメソッドは例外をスローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::IsSupported

アプリケーションを実行しているコンピューターでサポートされているかどうかを判断します CTaskDialog

static BOOL IsSupported();

戻り値

コンピューターが ; をサポートしている場合は CTaskDialogTRUE。FAL Standard Editionそれ以外の場合。

解説

この関数を使用して、アプリケーションを実行しているコンピューターがクラスをサポートしているかどうかを実行時に CTaskDialog 確認します。 コンピューターがサポートしていない場合は、ユーザーに CTaskDialog情報を伝達する別の方法を指定する必要があります。 クラスをサポートしていないコンピューターでアプリケーションを CTaskDialog 使用しようとすると、アプリケーションが CTaskDialog クラッシュします。

// TODO: Replace the string below with the actual message to the user
CString message("Important information to the user");
// TODO: Replace the string below with the title of this project
CString title("Project Title");

CString emptyString;

if (CTaskDialog::IsSupported())
{
   CTaskDialog::ShowDialog(message, emptyString, title, 0, 0,
                           TDCBF_OK_BUTTON);
}
else
{
   AfxMessageBox(message);
}

CTaskDialog::LoadCommandControls

文字列テーブルのデータを使用して、コマンド ボタン コントロールを追加します。

void LoadCommandControls(
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast);

パラメーター

nIDCommandControlsFirst
[in]最初のコマンドの文字列 ID。

nIDCommandControlsLast
[in]最後のコマンドの文字列 ID。

解説

このメソッドは、アプリケーションのリソース ファイルのデータを使用してコマンド ボタン コントロールを作成します。 リソース ファイル内の文字列テーブルには、関連付けられた文字列 ID を持つ複数の文字列があります。 このメソッドを使用して追加された新しいコマンド ボタン コントロールでは、コントロールのキャプションの文字列と、コントロールの ID の文字列 ID が使用されます。 選択した文字列の範囲は、nIDCommandControlsFirstnCommandControlsLast (両端を含む) によって提供されます。 範囲内に空のエントリがある場合、メソッドはそのエントリのコマンド ボタン コントロールを追加しません。

既定では、新しいコマンド ボタン コントロールは有効になっており、昇格は必要ありません。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::LoadRadioButtons

文字列テーブルのデータを使用して、ラジオ ボタン コントロールを追加します。

void LoadRadioButtons(
    int nIDRadioButtonsFirst,
    int nIDRadioButtonsLast);

パラメーター

nIDRadioButtonsFirst
[in]最初のラジオ ボタンの文字列 ID。

nIDRadioButtonsLast
[in]最後のラジオ ボタンの文字列 ID。

解説

このメソッドは、アプリケーションのリソース ファイルのデータを使用してラジオ ボタンを作成します。 リソース ファイル内の文字列テーブルには、関連付けられた文字列 ID を持つ複数の文字列があります。 このメソッドを使用して追加された新しいラジオ ボタンでは、ラジオ ボタンのキャプションの文字列と、ラジオ ボタンの ID の文字列 ID を使用します。 選択した文字列の範囲は、nIDRadioButtonsFirstnRadioButtonsLast (両端を含む) によって提供されます。 範囲内に空のエントリがある場合、メソッドはそのエントリのラジオ ボタンを追加しません。

既定では、新しいラジオ ボタンが有効になっています。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

フォーカスを別 CTaskDialogのフォーカスに転送します。

protected:
void NavigateTo(CTaskDialog& oTaskDialog) const;

パラメーター

oTaskDialog
[in] CTaskDialog フォーカスを受け取る値。

解説

このメソッドは、oTaskDialog を表示するときに現在CTaskDialogの値を非表示にします。 oTaskDialog は、現在CTaskDialogの位置と同じ場所に表示されます。

CTaskDialog::OnCommandControlClick

フレームワークは、ユーザーがコマンド ボタン コントロールをクリックすると、このメソッドを呼び出します。

virtual HRESULT OnCommandControlClick(int nCommandControlID);

パラメーター

nCommandControlID
[in]ユーザーが選択したコマンド ボタン コントロールの ID。

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnCreate

フレームワークは、作成後にこのメソッドを呼び出します CTaskDialog

virtual HRESULT OnCreate();

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnDestroy

フレームワークは、このメソッドを破棄する直前に呼び出します CTaskDialog

virtual HRESULT OnDestroy();

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnExpandButtonClick

フレームワークは、ユーザーが展開ボタンをクリックすると、このメソッドを呼び出します。

virtual HRESULT OnExpandButtonClicked(BOOL bExpanded);

パラメーター

bExpanded
[in]0 以外の値は、追加情報が表示されていることを示します。0 は、追加情報が非表示であることを示します。

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnHelp

フレームワークは、ユーザーがヘルプを要求したときにこのメソッドを呼び出します。

virtual HRESULT OnHelp();

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnHyperlinkClick

フレームワークは、ユーザーがハイパーリンクをクリックしたときにこのメソッドを呼び出します。

virtual HRESULT OnHyperlinkClick(const CString& strHref);

パラメーター

strHref
[in]ハイパーリンクを表す文字列。

戻り値

既定の実装では、S_OKが返されます。

解説

このメソッドは、S_OKを返す前に ShellExecute を呼び出します。

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnInit

フレームワークは、初期化時にこのメソッドを CTaskDialog 呼び出します。

virtual HRESULT OnInit();

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnNavigatePage

フレームワークは、CTaskDialog::NavigateTo メソッドに応答して このメソッドを 呼び出します。

virtual HRESULT OnNavigatePage();

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnRadioButtonClick

フレームワークは、ユーザーがラジオ ボタン コントロールを選択すると、このメソッドを呼び出します。

virtual HRESULT OnRadioButtonClick(int nRadioButtonID);

パラメーター

nRadioButtonID
[in]ユーザーがクリックしたラジオ ボタン コントロールの ID。

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnTimer

フレームワークは、タイマーの有効期限が切れると、このメソッドを呼び出します。

virtual HRESULT OnTimer(long lTime);

パラメーター

lTime
[in]作成されてから、またはタイマーが CTaskDialog リセットされてからのミリ秒単位の時間。

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::OnVerificationCheckboxClick

フレームワークは、ユーザーが検証チェック ボックスをクリックすると、このメソッドを呼び出します。

virtual HRESULT OnVerificationCheckboxClick(BOOL bChecked);

パラメーター

bChecked
[in]TRUE は、検証チェック ボックスが選択されていることを示します。FAL Standard Edition は、そうでないことが示されます。

戻り値

既定の実装では、S_OKが返されます。

解説

カスタム動作を実装するには、派生クラスでこのメソッドをオーバーライドします。

CTaskDialog::RemoveAllCommandControls

からすべてのコマンド ボタン コントロールを CTaskDialog削除します。

void RemoveAllCommandControls();

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::RemoveAllRadioButtons

からすべてのラジオ ボタンを削除します CTaskDialog

void RemoveAllRadioButtons();

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetCommandControlOptions

のコマンド ボタン コントロールを更新しますCTaskDialog

void SetCommandControlOptions(
    int nCommandControlID,
    BOOL bEnabled,
    BOOL bRequiresElevation = FALSE);

パラメーター

nCommandControlID
[in]更新するコマンド コントロールの ID。

bEnabled
[in]指定したコマンド ボタン コントロールが有効または無効になっているかどうかを示すブール型パラメーター。

bRequiresElevation
[in]指定したコマンド ボタン コントロールに昇格が必要かどうかを示すブール型パラメーター。

解説

このメソッドを使用して、コマンド ボタン コントロールが有効になっているか、クラスに追加 CTaskDialog された後に昇格が必要かを変更します。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::SetCommonButtonOptions

更新一般的なボタンのサブセットを有効にし、UAC 昇格を必要とします。

void SetCommonButtonOptions(
    int nDisabledButtonMask,
    int nElevationButtonMask = 0);

パラメーター

nDisabledButtonMask
[in]無効にする一般的なボタンのマスク。

nElevationButtonMask
[in]昇格を必要とする一般的なボタンのマスク。

解説

コンストラクター CTaskDialog::CTaskDialog とメソッド CTaskDialog::SetCommonButtons を使用して、CTaskDialog クラスのインスタンスで使用できる共通ボタンを設定できます。 CTaskDialog::SetCommonButtonOptions では、新しい共通ボタンの追加はサポートされていません。

このメソッドを使用して、このメソッドで使用CTaskDialogできない共通ボタンを無効または昇格させる場合、このメソッドは ENSURE マクロを使用して例外をスローします。

このメソッドは、以前にCTaskDialog無効にされていた場合でも、nDisabledButtonMask含まれていないボタンを有効にします。 このメソッドは、同様の方法で昇格を処理します。共通ボタンが使用できるが、nElevationButtonMask に含まれていない場合は、一般的なボタンを昇格を必要としないと記録します。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title);

// Create a button mask.
int buttons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON;
buttons |= TDCBF_RETRY_BUTTON | TDCBF_CLOSE_BUTTON;

taskDialog.SetCommonButtons(buttons);

// Disable the close button and make the retry button require
// elevation.
taskDialog.SetCommonButtonOptions(TDCBF_CLOSE_BUTTON,
                                  TDCBF_RETRY_BUTTON);

taskDialog.DoModal();

CTaskDialog::SetCommonButtons

共通のボタンを追加します。CTaskDialog

void SetCommonButtons(
    int nButtonMask,
    int nDisabledButtonMask = 0,
    int nElevationButtonMask = 0);

パラメーター

nButtonMask
[in]に追加するボタンの CTaskDialogマスク。

nDisabledButtonMask
[in]無効にするボタンのマスク。

nElevationButtonMask
[in]昇格を必要とするボタンのマスク。

解説

クラスのこのインスタンスの表示ウィンドウが作成された後、このメソッドを CTaskDialog 呼び出すことはできません。 その場合、このメソッドは例外をスローします。

nButtonMask によって 示されるボタンは、 以前に追加された一般的なボタンを CTaskDialogオーバーライドします。 nButtonMask示されているボタンのみが使用できます。

nDisabledButtonMask または nElevationButtonMask に含まれていないボタンが含まれている場合、このメソッドは ENSURE マクロを使用して例外をスローします。

既定では、すべての一般的なボタンが有効になっており、昇格は必要ありません。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title);

// Create a button mask.
int buttons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON;
buttons |= TDCBF_RETRY_BUTTON | TDCBF_CLOSE_BUTTON;

taskDialog.SetCommonButtons(buttons);

// Disable the close button and make the retry button require
// elevation.
taskDialog.SetCommonButtonOptions(TDCBF_CLOSE_BUTTON,
                                  TDCBF_RETRY_BUTTON);

taskDialog.DoModal();

CTaskDialog::SetContent

の内容を更新しますCTaskDialog

void SetContent(const CString& strContent);

パラメーター

strContent
[in]ユーザーに表示する文字列。

解説

クラスのCTaskDialog内容は、ダイアログ ボックスの [メイン] セクションにユーザーに表示されるテキストです。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetDefaultCommandControl

既定のコマンド ボタン コントロールを指定します。

void SetDefaultCommandControl(int nCommandControlID);

パラメーター

nCommandControlID
[in]既定のコマンド ボタン コントロールの ID。

解説

既定のコマンド ボタン コントロールは、ユーザーに最初に CTaskDialog 表示されるときに選択されるコントロールです。

このメソッドは、nCommandControlID指定されたコマンド ボタン コントロールが見つからない場合に例外をスローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title.
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::SetDefaultRadioButton

既定のラジオ ボタンを指定します。

void SetDefaultRadioButton(int nRadioButtonID);

パラメーター

nRadioButtonID
[in]既定値となるラジオ ボタンの ID。

解説

既定のラジオ ボタンは、ユーザーに最初に CTaskDialog 表示されるときに選択されるボタンです。

このメソッドは、nRadioButtonID指定されたラジオ ボタンが見つからない場合に例外をスローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetDialogWidth

の幅を調整します CTaskDialog

void SetDialogWidth(int nWidth = 0);

パラメーター

nWidth
[in]ダイアログ ボックスの幅 (ピクセル単位)。

解説

パラメーター nWidth は 0 以上である必要があります。 それ以外の場合、このメソッドは例外をスローします。

nWidth が 0 に設定されている場合、このメソッドはダイアログ ボックスを既定のサイズに設定します。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetExpansionArea

の拡張領域を更新しますCTaskDialog

void SetExpansionArea(
    const CString& strExpandedInformation,
    const CString& strCollapsedLabel = _T(""),
    const CString& strExpandedLabel = _T(""));

パラメーター

strExpandedInformation
[in]ユーザーが展開ボタンをCTaskDialogクリックしたときにダイアログ ボックスのメイン本文に表示される文字列。

strCollapsedLabel
[in]展開領域が CTaskDialog 折りたたまれているときに展開ボタンの横に表示される文字列。

strExpandedLabel
[in]展開領域が CTaskDialog 表示されるときに展開ボタンの横に表示される文字列。

解説

クラスの拡張領域を CTaskDialog 使用すると、ユーザーに追加情報を提供できます。 拡張領域は、タイトルとコンテンツ文字列のすぐCTaskDialog下にある、メイン部分にあります。

最初に CTaskDialog 表示されるときは、展開された情報は表示されず、展開ボタンの横に配置 strCollapsedLabel されます。 ユーザーが展開ボタンをクリックすると、CTaskDialogstrExpandedInformation が表示され、ラベルが strExpandedLabel変更されます。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetFooterIcon

のフッター アイコンを更新しますCTaskDialog

void SetFooterIcon(HICON hFooterIcon);
void SetFooterIcon(LPCWSTR lpszFooterIcon);

パラメーター

hFooterIcon
[in]の新しいアイコン CTaskDialog

lpszFooterIcon
[in]の新しいアイコン CTaskDialog

解説

フッター アイコンは、CTaskDialog クラス下部に表示されます。 関連付けられたフッター テキストを含めることができます。 フッター テキストは、CTaskDialog::SetFooterText変更できます。

このメソッドは、表示されている場合、または入力パラメーターが NULL の場合、CTaskDialogENSURE マクロで例外をスローします。

A CTaskDialog は、フッター アイコンまたはフッター アイコンとしてのみ受け入れHICONLPCWSTR可能です。 これは、コンストラクターまたは CTaskDialog::SetOptions でTDF_UStandard Edition_HICON_FOOTERオプションを設定することによって構成されます。 既定では、フッター アイコンの CTaskDialog 入力の種類として使用 LPCWSTR するように構成されています。 このメソッドは、不適切な種類を使用してアイコンを設定しようとすると、例外を生成します。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetFooterText

のフッターのテキストを更新しますCTaskDialog

void SetFooterText(const CString& strFooterText);

パラメーター

strFooterText
[in]フッターの新しいテキスト。

解説

フッター アイコンは、フッター テキストの下部 CTaskDialogに表示されます。 フッター アイコンは、CTaskDialog::SetFooterIcon変更できます。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetMainIcon

のメインアイコンを更新しますCTaskDialog

void SetMainIcon(HICON hMainIcon);
void SetMainIcon(LPCWSTR lpszMainIcon);

パラメーター

hMainIcon
[in]新しいアイコン。

lpszMainIcon
[in]新しいアイコン。

解説

このメソッドは、表示されている場合、または入力パラメーターが NULL の場合、CTaskDialogENSURE マクロで例外をスローします。

A CTaskDialog は、メイン アイコンとしてのみ受け入れHICONLPCWSTR可能です。 これを構成するには、コンストラクターまたは CTaskDialog::SetOptions メソッドで TDF_UStandard Edition_HICON_MAIN オプションを設定します。 既定では、メイン CTaskDialog アイコンの入力の種類として使用LPCWSTRするように構成されています。 このメソッドは、不適切な種類を使用してアイコンを設定しようとすると、例外を生成します。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetMainInstruction

のメイン命令を更新しますCTaskDialog

void SetMainInstruction(const CString& strInstructions);

パラメーター

strInstructions
[in]新しいメイン命令。

解説

クラスのCTaskDialogメイン命令は、大きな太字フォントでユーザーに表示されるテキストです。 これは、タイトル バーの下のダイアログ ボックスにあります。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetOptions

のオプションを構成します CTaskDialog

void SetOptions(int nOptionFlag);

パラメーター

nOptionFlag
[in]に使用するフラグの CTaskDialogセット。

解説

このメソッドは、すべての現在のオプションをクリアします。CTaskDialog 現在のオプションを保持するには、最初 に CTaskDialog::GetOptions を使用してそれらを取得し、設定するオプションと組み合わせる必要があります。

次の表に、有効なすべてのオプションを示します。

名前 説明
TDF_ENABLE_HYPERLINKS 内のハイパーリンクを CTaskDialog有効にします。
TDF_UStandard Edition_HICON_MAIN CTaskDialogメイン アイコンに a を使用HICONするように構成します。 別の方法は、 LPCWSTR.
TDF_UStandard Edition_HICON_FOOTER フッター アイコンに CTaskDialog a を使用 HICON するように構成します。 別の方法は、 LPCWSTR.
TDF_ALLOW_DIALOG_CANCELLATION [キャンセル] ボタンが有効になっていない場合でも、ユーザーがキーボードを使用するか、ダイアログ ボックスの右上隅にあるアイコンを使用して閉じCTaskDialogできるようにします。 このフラグが設定されておらず、[キャンセル] ボタンが有効になっていない場合、ユーザーは Alt + F4 キー、エスケープ キー、またはタイトル バーの閉じるボタンを使用してダイアログ ボックスを閉じることができません。
TDF_UStandard Edition_COMMAND_LINKS コマンド ボタン コントロールを CTaskDialog 使用するように構成します。
TDF_UStandard Edition_COMMAND_LINKS_NO_ICON コントロールの横に CTaskDialog アイコンを表示せずに、コマンド ボタン コントロールを使用するように構成します。 TDF_UStandard Edition_COMMAND_LINKSは、TDF_UStandard Edition_COMMAND_LINKS_NO_ICONをオーバーライドします。
TDF_EXPAND_FOOTER_AREA 拡張領域が現在展開されていることを示します。
TDF_EXPANDED_BY_DEFAULT 展開領域が既定で展開されているかどうかを判断します。
TDF_VERIFICATION_FLAG_CHECKED 検証チェック ボックスが現在選択されていることを示します。
TDF_SHOW_PROGRESS_BAR 進行状況バーを CTaskDialog 表示するように構成します。
TDF_SHOW_MARQUEnterprise Edition_PROGRESS_BAR マーキープログレス バーとして進行状況バーを構成します。 このオプションを有効にする場合は、期待される動作をTDF_SHOW_PROGRESS_BAR設定する必要があります。
TDF_CALLBACK_TIMER コールバック間隔が約 200 ミリ秒に設定されていることを CTaskDialog 示します。
TDF_POSITION_RELATIVE_TO_WINDOW 親ウィンドウを CTaskDialog 基準にして中央揃えになるように構成します。 このフラグが有効になっていない場合、モニターを CTaskDialog 基準にして中央揃えになります。
TDF_RTL_LAYOUT CTaskDialog右から左への読み取りレイアウトを構成します。
TDF_NO_DEFAULT_RADIO_BUTTON 表示されたときにラジオ ボタンが選択されていないことを CTaskDialog 示します。
TDF_CAN_BE_MINIMIZED ユーザーが を最小化できるようにします CTaskDialog。 このオプションを CTaskDialog サポートするために、モーダルにすることはできません。 MFC ではモードレス CTaskDialogがサポートされていないため、MFC ではこのオプションはサポートされません。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::SetProgressBarMarquee

マーキー バー CTaskDialog を構成し、ダイアログ ボックスに追加します。

void SetProgressBarMarquee(
    BOOL bEnabled = TRUE,
    int nMarqueeSpeed = 0);

パラメーター

bEnabled
[in]マーキー バーを有効にする場合は TRUE。FAL Standard Editionマーキーバーを無効にし、から削除しますCTaskDialog.

nMarqueeSpeed
[in]マーキー バーの速度を示す整数。

解説

マーキー バーは、クラスのメインテキストの下にCTaskDialog表示されます。

マーキー バーの速度を設定するには nMarqueeSpeed を使用します。値が大きいほど速度が遅いことを示します。 nMarqueeSpeed値が 0 の場合、マーキー バーは Windows の既定の速度で移動します。

nMarqueeSpeed が 0 未満の場合、このメソッドは ENSURE マクロで例外をスローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarPosition

進行状況バーの位置を調整します。

void SetProgressBarPosition(int nProgressPos);

パラメーター

nProgressPos
[in]進行状況バーの位置。

解説

nProgressPos が進行状況バーの範囲内にない場合、このメソッドは ENSURE マクロで例外をスローします。 CTaskDialog::SetProgressBarRange を使用して進行状況バーの範囲を変更できます。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarRange

進行状況バーの範囲を調整します。

void SetProgressBarRange(
    int nRangeMin,
    int nRangeMax);

パラメーター

nRangeMin
[in]進行状況バーの下限。

nRangeMax
[in]進行状況バーの上限。

解説

進行状況バーの位置は、nRangeMin と nRangeMax に対する相対位置です。 たとえば、nRangeMin が 50 で nRangeMax が 100 の場合、75 の位置は進行状況バーの途中にあります。 CTaskDialog::SetProgressBarPosition を使用して、進行状況バーの位置を設定します。

進行状況バーを表示するには、オプション TDF_SHOW_PROGRESS_BARを有効にし、TDF_SHOW_MARQUEnterprise Edition_PROGRESS_BARを有効にすることはできません。 このメソッドは、TDF_SHOW_PROGRESS_BARを自動的に設定し、TDF_SHOW_MARQUEnterprise Edition_PROGRESS_BARをクリアします。 CTaskDialog::SetOptions を使用して、CTaskDialog クラスのこのインスタンスのオプションを手動で変更します。

nRangeMin が nRangeMax より小さくない場合、このメソッドは ENSURE マクロで例外をスローします。 このメソッドは、既に CTaskDialog 表示されていて、マーキー進行状況バーがある場合にも例外をスローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarState

進行状況バーの状態を設定し、CTaskDialog

void SetProgressBarState(int nState = PBST_NORMAL);

パラメーター

nState
[in]進行状況バーの状態。 使用可能な値については、「解説」セクションを参照してください。

解説

このメソッドは、既に表示されていてマーキー進行状況バーがある場合CTaskDialog、ENSURE マクロで例外をスローします。

次の表に、nState に指定できる値を示します。 いずれの場合も、進行状況バーは、指定された停止位置に達するまで通常の色で塗りつぶされます。 その時点で、状態に基づいて色が変更されます。

名前 説明
PBST_NORMAL 進行状況バーが塗りつぶされた後、 CTaskDialog バーの色は変更されません。 既定では、通常の色は緑です。
PBST_ERROR 進行状況バーが塗りつぶされると、 CTaskDialog バーの色がエラーの色に変更されます。 既定では、これは赤です。
PBST_PAUStandard Edition D 進行状況バーが塗りつぶされると、 CTaskDialog バーの色が一時停止した色に変更されます。 既定では、これは黄色です。

CTaskDialog::SetProgressBarPosition進行状況バーが停止する場所を設定できます。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetRadioButtonOptions

ラジオ ボタンを有効または無効にします。

void SetRadioButtonOptions(
    int nRadioButtonID,
    BOOL bEnabled);

パラメーター

nRadioButtonID
[in]ラジオ ボタン コントロールの ID。

bEnabled
[in]ラジオ ボタンを有効にする場合は TRUE。FAL Standard Edition オプション ボタンを無効にします。

解説

nRadioButtonID がラジオ ボタンの有効な ID でない場合、このメソッドは ENSURE マクロで例外をスローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetVerificationCheckbox

検証チェック ボックスのチェック状態を設定します。

void SetVerificationCheckbox(BOOL bChecked);

パラメーター

bChecked
[in]TRUE を指定すると、検証チェックボックスが表示されたときにCTaskDialog選択されます。FAL Standard Editionが表示されたときに検証チェックボックスをCTaskDialogオフにします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::SetVerificationCheckboxText

検証チェック ボックスの右側に表示されるテキストを設定します。

void SetVerificationCheckboxText(CString& strVerificationText);

パラメーター

strVerificationText
[in]このメソッドが検証チェック ボックスの横に表示されるテキスト。

解説

クラスのこのインスタンスが既に表示されている場合、 このメソッドは ENSURE マクロで例外を CTaskDialog スローします。

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::SetWindowTitle

のタイトルを設定します CTaskDialog

void SetWindowTitle(CString& strWindowTitle);

パラメーター

strWindowTitle
[in]の新しいタイトル CTaskDialog

解説

// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title,
                       TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON);

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
                            L"Click here for more information.",
                            L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

CTaskDialog::ShowDialog

を作成して表示します CTaskDialog

static INT_PTR ShowDialog(
    const CString& strContent,
    const CString& strMainInstruction,
    const CString& strTitle,
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast,
    int nCommonButtons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON,
    int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
    const CString& strFooter = _T(""));

パラメーター

strContent
[in]の内容 CTaskDialogに使用する文字列。

strMainInstruction
[in]のメイン命令CTaskDialog

strTitle
[in]のタイトル CTaskDialog

nIDCommandControlsFirst
[in]最初のコマンドの文字列 ID。

nIDCommandControlsLast
[in]最後のコマンドの文字列 ID。

nCommonButtons
[in]に追加するボタンの CTaskDialogマスク。

nTaskDialogOptions
[in]に使用するオプションの CTaskDialogセット。

strFooter
[in]フッターとして使用する文字列。

戻り値

ユーザーが行った選択に対応する整数。

解説

この静的メソッドを使用すると、コード内にオブジェクトを CTaskDialog 明示的に作成することなく、クラスのインスタンスを CTaskDialog 作成できます。 オブジェクトがないため CTaskDialog 、このメソッドを使用してユーザーに CTaskDialog 表示 CTaskDialog する場合は、その他のメソッドを呼び出すことはできません。

このメソッドは、アプリケーションのリソース ファイルのデータを使用してコマンド ボタン コントロールを作成します。 リソース ファイル内の文字列テーブルには、関連付けられた文字列 ID を持つ複数の文字列があります。 このメソッドは、nIDCommandControlsFirst と nCommandControlsLast の間の文字列テーブル内の有効な各エントリに対してコマンド ボタン コントロールを追加します。このコントロールを含めます。 これらのコマンド ボタン コントロールの場合、文字列テーブル内の文字列はコントロールのキャプションであり、文字列 ID はコントロールの ID です。

有効なオプションの一覧については、CTaskDialog::SetOptions を参照してください

ユーザーが CTaskDialog 共通ボタン、コマンド リンク コントロール、または閉じると閉じます CTaskDialog。 戻り値は、ユーザーがダイアログ ボックスを閉じた方法を示す識別子です。

// TODO: Replace the string below with the actual message to the user
CString message("Important information to the user");
// TODO: Replace the string below with the title of this project
CString title("Project Title");

CString emptyString;

if (CTaskDialog::IsSupported())
{
   CTaskDialog::ShowDialog(message, emptyString, title, 0, 0,
                           TDCBF_OK_BUTTON);
}
else
{
   AfxMessageBox(message);
}

CTaskDialog::TaskDialogCallback

フレームワークは、さまざまな Windows メッセージに応答してこのメソッドを呼び出します。

friend:
HRESULT TaskDialogCallback(
    HWND hWnd,
    UINT uNotification,
    WPARAM wParam,
    LPARAM lParam,
    LONG_PTR dwRefData);

パラメーター

Hwnd
[in]の構造体CTaskDialogへのm_hWndハンドル。

uNotification
[in]生成されたメッセージを指定する通知コード。

wParam
[in]メッセージの詳細。

lParam
[in]メッセージの詳細。

dwRefData
[in]コールバック メッセージが CTaskDialog 適用されるオブジェクトへのポインター。

戻り値

特定の通知コードによって異なります。 詳細については、次の「解説」を参照してください。

解説

既定の実装では、特定のTaskDialogCallbackメッセージを処理し、CTaskDialog クラスの適切な On メソッドを呼び出します。 たとえば、TDN_BUTTON_CLICKED メッセージに応答して CTaskDialog TaskDialogCallback ::OnCommandControlClick を呼び出 します

wParam と lParam値は、生成された特定のメッセージによって異なります。 これらの値のいずれかまたは両方を空にすることができます。 次の表に、サポートされている既定の通知と、wParam と lParam値が表す内容を示します。 派生クラスでこのメソッドをオーバーライドする場合は、次の表の各メッセージのコールバック コードを実装する必要があります。

通知メッセージ wParam lParam
TDN_CREATED 使用しません。 使用しません。
TDN_NAVIGATED 使用しません。 使用しません。
TDN_BUTTON_CLICKED コマンド ボタンコントロール ID。 使用しません。
TDN_HYPERLINK_CLICKED 使用しません。 リンクを含む LPCWSTR 構造体。
TDN_TIMER 作成されてから、またはタイマーが CTaskDialog リセットされてからのミリ秒単位の時間。 使用しません。
TDN_DESTROYED 使用しません。 使用しません。
TDN_RADIO_BUTTON_CLICKED ラジオ ボタン ID。 使用しません。
TDN_DIALOG_CONSTRUCTED 使用しません。 使用しません。
TDN_VERIFICATION_CLICKED チェックボックスがチェックされている場合は 1、そうでない場合は 0。 使用しません。
TDN_HELP 使用しません。 使用しません。
TDN_EXPANDO_BUTTON_CLICKED 拡張領域が折りたたまれている場合は 0。展開テキストが表示される場合は 0 以外。 使用しません。

関連項目

クラス
CObject クラス
階層図
チュートリアル: アプリケーションへの CTaskDialog の追加