CTaskDialog にコモン ボタンを追加します。
void SetCommonButtons(
int nButtonMask,
int nDisabledButtonMask = 0,
int nElevationButtonMask = 0
);
パラメーター
[入力] nButtonMask
CTaskDialog に追加するボタンのマスク。[入力] nDisabledButtonMask
無効にするボタンのマスク。[入力] nElevationButtonMask
昇格を必要とするボタンのマスク。
解説
CTaskDialog クラス のこのインスタンスに対して表示ウィンドウが作成された後にこのメソッドを呼び出すことはできません。 その場合、このメソッドは例外をスローします。
nButtonMask で指定されているボタンは、以前に CTaskDialog に追加されたすべてのコモン ボタンよりも優先されます。 使用できるのは、nButtonMask で指定されているボタンのみです。
nButtonMask で指定されていないボタンが nDisabledButtonMask または nElevationButtonMask に含まれている場合、このメソッドは、ENSURE (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);
// 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();
必要条件
**ヘッダー:**afxtaskdialog.h