CTaskDialog::SetCommonButtonOptions

更新會啟用和要求 UAC 權限升級的一般按鈕的子集。

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

參數

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

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

備註

您可以將一般按鈕可供 CTaskDialog 類別 執行個體使用建構函式 CTaskDialog::CTaskDialog 和方法 CTaskDialog::SetCommonButtonsCTaskDialog::SetCommonButtonOptions 不支援加入新的一般按鈕。

如果您使用這個方法會停用或提高為這個 CTaskDialog沒有可用的一個常見的按鈕,這個方法會擲回使用 確保 (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

請參閱

參考

CTaskDialog 類別

階層架構圖

CTaskDialog::CTaskDialog

CTaskDialog::SetCommonButtons