다음을 통해 공유


CTaskDialog::CTaskDialog

CTaskDialog 클래스의 인스턴스를 만듭니다.

CTaskDialog(
   const CString& strContent,
   const CString& strMainInstruction,
   const CString& strTitle,
   int nCommonButtons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON,
   int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
   const CString& strFooter = _T("")
);

CTaskDialog(
   const CString& strContent,
   const CString& strMainInstruction,
   const CString& strTitle,
   int nIDCommandControlsFirst,
   int nIDCommandControlsLast,
   int nCommonButtons,
   int nTaskDialogOptions = TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS,
   const CString& strFooter = _T("")
);

매개 변수

  • [in] strContent
    문자열의 내용을 사용 하 여 CTaskDialog.

  • [in] strMainInstruction
    기본 명령에는 CTaskDialog.

  • [in] strTitle
    CTaskDialog의 제목입니다.

  • [in] nCommonButtons
    마스크의 일반적인 단추를 추가 하는 CTaskDialog.

  • [in] nTaskDialogOptions
    설정 옵션을 사용 하 여 CTaskDialog.

  • [in] strFooter
    바닥글로 사용할 문자열입니다.

  • [in] nIDCommandControlsFirst
    첫 번째 명령의 문자열 ID입니다.

  • [in] nIDCommandControlsLast
    마지막 명령의 문자열 ID입니다.

설명

추가할 수 있는 두 가지는 CTaskDialog 응용 프로그램.첫 번째 방법은 만들려면 생성자 중 하나를 사용 하는 것은 CTaskDialog 및 표시를 사용 하 여 CTaskDialog::DoModal.두 번째 방법은 정적 함수를 사용 하는 것 CTaskDialog::ShowDialog, 수를 표시 하는 CTaskDialog 명시적으로 만들지 않고는 CTaskDialog 개체.

두 번째 생성자는 응용 프로그램의 리소스 파일에서 데이터를 사용 하 여 명령 단추 컨트롤을 만듭니다.문자열 테이블 리소스 파일에서 여러 문자열 연결 문자열 id가 있습니다.이 메서드를 문자열 테이블 사이에서 명령 단추 컨트롤의 유효한 각 엔트리의 추가 nIDCommandControlsFirst 및 nCommandControlsLast을 포함 합니다.이러한 명령 단추 컨트롤의 경우 컨트롤의 캡션 문자열 테이블에서 문자열입니다. 및 컨트롤의 ID 문자열 ID입니다.

CTaskDialog::SetOptions 사용할 수 있는 옵션의 목록입니다.

예제

// 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, 
    TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON );

// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);

// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);

// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
    L"Click here for more information.",
    L"Click here to hide the extra information.");

// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);

taskDialog.DoModal();

요구 사항

헤더: afxtaskdialog.h

참고 항목

작업

연습: 응용 프로그램에 추가 하는 CTaskDialog

참조

CTaskDialog 클래스

계층 구조 차트

CTaskDialog::ShowDialog

CTaskDialog::DoModal

CTaskDialog::SetOptions