CTaskDialog::SetCommonButtons

將一般的按鈕加入至 CTaskDialog

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

參數

  • [in] nButtonMask
    將按鈕的遮罩套用至 CTaskDialog

  • [in] nDisabledButtonMask
    停用的按鈕的遮罩。

  • [in] nElevationButtonMask
    需要提高權限按鈕的遮罩。

備註

CTaskDialog 類別 的這個執行個體的顯示視窗建立之後,您就可以呼叫這個方法。如果您,這個方法會擲回例外狀況。

nButtonMask 運算式的 按鈕會覆寫所有一般按鈕之前加入 CTaskDialog。在 nButtonMask 只表示的按鈕來使用。

如果 nDisabledButtonMask 或 nElevationButtonMask 包含不在 nButtonMask的按鈕,這個方法會擲回使用 確保 (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

請參閱

參考

CTaskDialog 類別

階層架構圖

CTaskDialog::SetCommonButtonOptions