다음을 통해 공유


CTaskDialog::DoModal

표시는 CTaskDialog 및 모달이 됩니다.

INT_PTR DoModal (
   HWND hParent = ::GetActiveWindow()
);

매개 변수

  • [in] hParent
    부모 창에는 CTaskDialog.

반환 값

사용자가 선택한 사항에 해당 하는 정수입니다.

설명

이 인스턴스의 표시는 CTaskDialog.그런 다음 응용 프로그램 사용자에 대 한 대화 상자를 닫으려면 기다립니다.

CTaskDialog 사용자는 일반적인 단추 명령 링크 컨트롤을 선택 하는 경우 닫습니다 닫습니다는 CTaskDialog.반환 값은 사용자가 대화 상자를 닫은 방법을 나타내는 식별자입니다.

예제

// 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 클래스

계층 구조 차트