Share via


CTaskDialog::DoModal

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

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

パラメーター

  • [入力] hParent
    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();

必要条件

**ヘッダー:**afxtaskdialog.h

参照

参照

CTaskDialog クラス

階層図