コモン ボタンのサブセットを更新して有効にし、UAC 昇格を要求します。
void SetCommonButtonOptions(
int nDisabledButtonMask,
int nElevationButtonMask = 0
);
パラメーター
[入力] nDisabledButtonMask
無効にするコモン ボタンのマスク。[入力] nElevationButtonMask
昇格を必要とするコモン ボタンのマスク。
解説
コモン ボタンを CTaskDialog クラスのインスタンスで使用できるようにするには、CTaskDialog::CTaskDialog コンストラクターと CTaskDialog::SetCommonButtons メソッドを使用します。 CTaskDialog::SetCommonButtonOptions では、新しいコモン ボタンの追加はサポートされません。
このメソッドを使用して、この CTaskDialog で使用できないコモン ボタンを無効化または昇格した場合、このメソッドは ENSURE (MFC) マクロを使用して例外をスローします。
このメソッドにより、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();
必要条件
**ヘッダー:**afxtaskdialog.h