CTaskDialog::ShowDialog

建立和顯示 CTaskDialog

static INT_PTR ShowDialog(
   const CString& strContent,
   const CString& strMainInstruction,
   const CString& strTitle,
   int nIDCommandControlsFirst,
   int nIDCommandControlsLast,
   int nCommonButtons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON,
   int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
   const CString& strFooter = _T("")
);

參數

  • [in] strContent
    使用指定的 URI CTaskDialog的內容。

  • [in] strMainInstruction
    CTaskDialog主要的指示。

  • [in] strTitle
    CTaskDialog 的標題。

  • [in] nIDCommandControlsFirst
    第一個命令 ID 的字串。

  • [in] nIDCommandControlsLast
    最後一個命令 ID 的字串。

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

  • [in] nTaskDialogOptions
    使用的選項。 CTaskDialog

  • [in] strFooter
    使用字串做為的頁尾。

傳回值

對應至選取範圍中的整數是由使用者所做的。

備註

這個靜態方法可讓您建立 CTaskDialog 類別 的執行個體,而不需明確建立 CTaskDialog 物件至程式碼。因為沒有 CTaskDialog 物件,就無法呼叫 CTaskDialog 的任何其他方法,如果您使用這個方法 CTaskDialog 顯示給使用者。

這個方法會建立命令按鈕控制項會使用資料從應用程式資源檔中。在資源檔中的字串資料表有關聯的字串 ID 的多個字串。這個方法會將每一個有效輸入的命令按鈕控制項在 nIDCommandControlsFirst 和 nCommandControlsLast的字串資料表中,包含。如需這些命令按鈕控制項,字串資料表是控制項的標題,以及字串 ID 是控制項的 ID.

如需有效選項清單中看到 CTaskDialog::SetOptions

當使用者選取某個一般按鈕,命令連結控制或關閉 CTaskDialogCTaskDialog 關閉。傳回值是指示的識別使用者如何關閉對話方塊。

範例

    // TODO: Replace the string below with the actual message to the user
    CString message("Important information to the user");
    // TODO: Replace the string below with the title of this project
    CString title("Project Title");

    CString emptyString;

    if (CTaskDialog::IsSupported())
    {
        CTaskDialog::ShowDialog(message, emptyString, title, 0, 0, 
            TDCBF_OK_BUTTON);
    }
    else
    {
        AfxMessageBox(message);
    }

需求

標題: afxtaskdialog.h

請參閱

工作

逐步解說: 在應用程式中加入 CTaskDialog

參考

CTaskDialog 類別

階層架構圖

CTaskDialog::CTaskDialog