CTaskDialog 클래스

메시지 상자처럼 작동하지만 사용자에게 추가 정보를 표시할 수 있는 팝업 대화 상자입니다. CTaskDialog 에는 사용자로부터 정보를 수집하는 기능을 포함합니다.

구문

class CTaskDialog : public CObject

멤버

생성자

이름 설명
CTaskDialog::CTaskDialog CTaskDialog 개체를 생성합니다.

메서드

이름 설명
CTaskDialog::AddCommandControl 에 명령 단추 컨트롤을 추가합니다 CTaskDialog.
CTaskDialog::AddRadioButton 에 라디오 단추를 추가합니다 CTaskDialog.
CTaskDialog::ClickCommandControl 프로그래밍 방식으로 명령 단추 컨트롤 또는 일반 단추를 클릭합니다.
CTaskDialog::ClickRadioButton 프로그래밍 방식으로 라디오 단추를 클릭합니다.
CTaskDialog::D oModal CTaskDialog를 표시합니다.
CTaskDialog::GetCommonButtonCount 사용 가능한 일반적인 단추 수를 검색합니다.
CTaskDialog::GetCommonButtonFlag 표준 Windows 단추를 클래스와 연결된 공통 단추 유형으로 변환합니다 CTaskDialog .
CTaskDialog::GetCommonButtonId 클래스와 연결된 CTaskDialog 공통 단추 유형 중 하나를 표준 Windows 단추로 변환합니다.
CTaskDialog::GetOptions CTaskDialog옵션 플래그를 반환합니다.
CTaskDialog::GetSelectedCommandControlID 선택한 명령 단추 컨트롤을 반환합니다.
CTaskDialog::GetSelectedRadioButtonID 선택한 라디오 단추를 반환합니다.
CTaskDialog::GetVerificationCheckboxState 확인 검사 상자의 상태를 검색합니다.
CTaskDialog::IsCommandControlEnabled 명령 단추 컨트롤 또는 일반 단추를 사용할 수 있는지 여부를 결정합니다.
CTaskDialog::IsRadioButtonEnabled 라디오 단추를 사용할 수 있는지 여부를 결정합니다.
CTaskDialog::IsSupported 애플리케이션을 실행하는 컴퓨터가 지원되는지 여부를 확인합니다 CTaskDialog.
CTaskDialog::LoadCommandControls 문자열 테이블의 데이터를 사용하여 명령 단추 컨트롤을 추가합니다.
CTaskDialog::LoadRadioButtons 문자열 테이블의 데이터를 사용하여 라디오 단추를 추가합니다.
CTaskDialog::NavigateTo 포커스를 다른 CTaskDialog포커스로 전송합니다.
CTaskDialog::OnCommandControlClick 프레임워크는 사용자가 명령 단추 컨트롤을 클릭할 때 이 메서드를 호출합니다.
CTaskDialog::OnCreate 프레임워크는 이 메서드를 만든 후 호출합니다 CTaskDialog.
CTaskDialog::OnDestroy 프레임워크는 이 메서드를 삭제하기 직전에 호출합니다 CTaskDialog.
CTaskDialog::OnExpandButtonClick 프레임워크는 사용자가 확장 단추를 클릭할 때 이 메서드를 호출합니다.
CTaskDialog::OnHelp 프레임워크는 사용자가 도움을 요청할 때 이 메서드를 호출합니다.
CTaskDialog::OnHyperlinkClick 프레임워크는 사용자가 하이퍼링크를 클릭할 때 이 메서드를 호출합니다.
CTaskDialog::OnInit 프레임워크는 초기화될 때 이 메서드를 CTaskDialog 호출합니다.
CTaskDialog::OnNavigatePage 프레임워크는 사용자가 컨트롤과 관련하여 포커스를 이동할 때 이 메서드를 호출합니다 CTaskDialog.
CTaskDialog::OnRadioButtonClick 프레임워크는 사용자가 라디오 단추 컨트롤을 선택할 때 이 메서드를 호출합니다.
CTaskDialog::OnTimer 프레임워크는 타이머가 만료되면 이 메서드를 호출합니다.
CTaskDialog::OnVerificationCheckboxClick 프레임워크는 사용자가 확인 검사 상자를 클릭할 때 이 메서드를 호출합니다.
CTaskDialog::RemoveAllCommandControls 에서 모든 명령 컨트롤을 CTaskDialog제거합니다.
CTaskDialog::RemoveAllRadioButtons 에서 모든 라디오 단추를 제거합니다 CTaskDialog.
CTaskDialog::SetCommandControlOptions 에 명령 단추 컨트롤을 CTaskDialog업데이트.
CTaskDialog::SetCommonButtonOptions UAC 권한 상승을 사용하도록 설정하고 요구하는 공통 단추의 하위 집합을 업데이트.
CTaskDialog::SetCommonButtons 에 공통 단추를 추가합니다 CTaskDialog.
CTaskDialog::SetContent CTaskDialog콘텐츠를 업데이트.
CTaskDialog::SetDefaultCommandControl 기본 명령 단추 컨트롤을 지정합니다.
CTaskDialog::SetDefaultRadioButton 기본 라디오 단추를 지정합니다.
CTaskDialog::SetDialogWidth 의 너비를 CTaskDialog조정합니다.
CTaskDialog::SetExpansionArea 의 확장 영역을 CTaskDialog업데이트.
CTaskDialog::SetFooterIcon 에 대한 바닥글 아이콘을 CTaskDialog업데이트.
CTaskDialog::SetFooterText 의 바닥글CTaskDialog에 텍스트를 업데이트.
CTaskDialog::SetMainIcon 의 기본 아이콘CTaskDialog을 업데이트.
CTaskDialog::SetMainInstruction 의 기본 명령을 CTaskDialog업데이트.
CTaskDialog::SetOptions 에 대한 CTaskDialog옵션을 구성합니다.
CTaskDialog::SetProgressBarMarquee 대화 상자의 선택 윤곽 표시줄을 CTaskDialog 구성하고 대화 상자에 추가합니다.
CTaskDialog::SetProgressBarPosition 진행률 표시줄의 위치를 조정합니다.
CTaskDialog::SetProgressBarRange 진행률 표시줄의 범위를 조정합니다.
CTaskDialog::SetProgressBarState 진행률 표시줄의 상태를 설정하고 에 표시합니다 CTaskDialog.
CTaskDialog::SetRadioButtonOptions 라디오 단추를 사용하거나 사용하지 않도록 설정합니다.
CTaskDialog::SetVerificationCheckbox 확인 검사 상자의 검사 상태를 설정합니다.
CTaskDialog::SetVerificationCheckboxText 확인 검사 상자의 오른쪽에 있는 텍스트를 설정합니다.
CTaskDialog::SetWindowTitle 의 제목을 CTaskDialog설정합니다.
CTaskDialog::ShowDialog 를 만들고 표시합니다 CTaskDialog.
CTaskDialog::TaskDialogCallback 프레임워크는 다양한 Windows 메시지에 대한 응답으로 이를 호출합니다.

데이터 멤버

이름 설명
m_aButtons 에 대한 CTaskDialog명령 단추 컨트롤의 배열입니다.
m_aRadioButtons 에 대한 라디오 단추 컨트롤의 배열입니다 CTaskDialog.
m_bVerified TRUE은 확인 검사 상자가 검사; FALSE 그렇지 않음을 나타냅니다.
m_footerIcon 의 바닥글에 있는 아이콘입니다 CTaskDialog.
m_hWnd 창에 대한 핸들입니다 CTaskDialog.
m_mainIcon 의 기본 아이콘입니다CTaskDialog.
m_nButtonDisabled 사용할 수 없는 일반 단추를 나타내는 마스크입니다.
m_nButtonElevation UAC 권한 상승이 필요한 일반적인 단추를 나타내는 마스크입니다.
m_nButtonId 선택한 명령 단추 컨트롤의 ID입니다.
m_nCommonButton 에 표시되는 CTaskDialog일반적인 단추를 나타내는 마스크입니다.
m_nDefaultCommandControl 표시될 때 선택된 명령 단추 컨트롤의 CTaskDialog ID입니다.
m_nDefaultRadioButton 표시될 때 선택된 라디오 단추 컨트롤의 CTaskDialog ID입니다.
m_nFlags 에 대한 옵션을 나타내는 마스크입니다 CTaskDialog.
m_nProgressPos 진행률 표시줄의 현재 위치입니다. 이 값은 m_nProgressRangeMinm_nProgressRangeMax 사이의 값이어야 합니다.
m_nProgressRangeMax 진행률 표시줄의 최대값입니다.
m_nProgressRangeMin 진행률 표시줄의 최소값입니다.
m_nProgressState 진행률 표시줄의 상태입니다. 자세한 내용은 CTaskDialog::SetProgressBarState를 참조하세요.
m_nRadioId 선택한 라디오 단추 컨트롤의 ID입니다.
m_nWidth CTaskDialog의 너비(픽셀)입니다.
m_strCollapse 확장된 정보가 숨겨지면 확장 상자의 오른쪽에 표시되는 문자열 CTaskDialog 입니다.
m_strContent 의 콘텐츠 문자열입니다 CTaskDialog.
m_strExpand 확장된 정보가 표시될 때 확장 상자의 오른쪽에 표시되는 문자열 CTaskDialog 입니다.
m_strFooter 의 바닥글입니다 CTaskDialog.
m_strInformation 에 대한 확장된 정보입니다 CTaskDialog.
m_strMainInstruction 의 기본 명령입니다CTaskDialog.
m_strTitle 의 제목입니다 CTaskDialog.
m_strVerification 확인 검사 상자의 오른쪽에 표시되는 문자열 CTaskDialog 입니다.

설명

이 클래스는 CTaskDialog 표준 Windows 메시지 상자를 대체하고 사용자로부터 정보를 수집하는 새 컨트롤과 같은 추가 기능을 제공합니다. 이 클래스는 Visual Studio 2010 이상의 MFC 라이브러리에 있습니다. Windows CTaskDialog Vista부터 사용할 수 있습니다. 이전 버전의 Windows에서는 개체를 표시할 CTaskDialog 수 없습니다. 런타임 시 현재 사용자가 작업 대화 상자를 표시할 수 있는지 여부를 확인하는 데 사용합니다 CTaskDialog::IsSupported . 표준 Windows 메시지 상자는 계속 지원됩니다.

유니 CTaskDialog 코드 라이브러리를 사용하여 애플리케이션을 빌드할 때만 사용할 수 있습니다.

CTaskDialog 개의 서로 다른 생성자가 있습니다. 하나의 생성자를 사용하면 두 개의 명령 단추와 최대 6개의 일반 단추 컨트롤을 지정할 수 있습니다. 를 만든 CTaskDialog후 명령 단추를 더 추가할 수 있습니다. 두 번째 생성자는 명령 단추를 지원하지 않지만 무제한의 일반 단추 컨트롤을 추가할 수 있습니다. 생성자에 대한 자세한 내용은 CTaskDialog::CTaskDialog를 참조하세요.

다음 이미지는 일부 컨트롤의 위치를 보여 줍니다.CTaskDialog

Example of CTaskDialog.
CTaskDialog 샘플

요구 사항

최소 필수 운영 체제: Windows Vista

헤더: afxtaskdialog.h

CTaskDialog::AddCommandControl

에 새 명령 단추 컨트롤을 CTaskDialog추가합니다.

void AddCommandControl(
    int nCommandControlID,
    const CString& strCaption,
    BOOL bEnabled = TRUE,
    BOOL bRequiresElevation = FALSE);

매개 변수

nCommandControlID
[in] 명령 컨트롤 ID 번호입니다.

strCaption
[in] 사용자에게 표시되는 문자열 CTaskDialog 입니다. 이 문자열을 사용하여 명령의 용도를 설명합니다.

bEnabled
[in] 새 단추를 사용할 수 있는지 여부를 나타내는 부울 매개 변수입니다.

bRequiresElevation
[in] 명령에 상승이 필요한지 여부를 나타내는 부울 매개 변수입니다.

설명

명령 CTaskDialog Class 단추 컨트롤을 무제한으로 표시할 수 있습니다. 그러나 명령 단추 컨트롤이 CTaskDialog 표시되면 최대 6개의 단추를 표시할 수 있습니다. CTaskDialog 명령 단추 컨트롤이 없는 경우 단추를 무제한으로 표시할 수 있습니다.

사용자가 명령 단추 컨트롤 CTaskDialog 을 선택하면 닫힙니다. 애플리케이션에서 CTaskDialog::D oModalDoModal을 사용하여 대화 상자를 표시하는 경우 선택한 명령 단추 컨트롤의 nCommandControlID를 반환합니다.

예시

// 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);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::AddRadioButton

에 라디오 단추를 추가합니다 CTaskDialog.

void CTaskDialog::AddRadioButton(
    int nRadioButtonID,
    const CString& strCaption,
    BOOL bEnabled = TRUE);

매개 변수

nRadioButtonID
[in] 라디오 단추의 ID 번호입니다.

strCaption
[in] 라디오 단추 옆에 표시되는 문자열 CTaskDialog 입니다.

bEnabled
[in] 라디오 단추를 사용할 수 있는지 여부를 나타내는 부울 매개 변수입니다.

설명

CTaskDialog 클래스라디오 단추를 사용하면 사용자로부터 정보를 수집할 수 있습니다. CTaskDialog::GetSelectedRadioButtonID 함수를 사용하여 선택한 라디오 단추를 확인합니다.

CTaskDialog nRadioButtonID 매개 변수가 각 라디오 단추에 대해 고유할 필요는 없습니다. 그러나 각 라디오 단추에 대해 고유 식별자를 사용하지 않는 경우 예기치 않은 동작이 발생할 수 있습니다.

예시

// 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);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::ClickCommandControl

프로그래밍 방식으로 명령 단추 컨트롤 또는 일반 단추를 클릭합니다.

protected:
void ClickCommandControl(int nCommandControlID) const;

매개 변수

nCommandControlID
[in] 클릭할 컨트롤의 명령 ID입니다.

설명

이 메서드는 windows 메시지 TDM_CLICK_BUTTON 생성합니다.

CTaskDialog::ClickRadioButton

프로그래밍 방식으로 라디오 단추를 클릭합니다.

protected:
void ClickRadioButton(int nRadioButtonID) const;

매개 변수

nRadioButtonID
[in] 클릭할 라디오 단추의 ID입니다.

설명

이 메서드는 windows 메시지 TDM_CLICK_RADIO_BUTTON 생성합니다.

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(""));

매개 변수

strContent
[in] 의 내용에 사용할 문자열입니다 CTaskDialog.

strMainInstruction
[in] 의 기본 명령입니다CTaskDialog.

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

nCommonButtons
[in] 에 추가할 공통 단추의 마스크입니다 CTaskDialog.

nTaskDialogOptions
[in] 에 사용할 옵션 집합입니다 CTaskDialog.

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

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

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

설명

애플리케이션에 추가할 수 있는 CTaskDialog 두 가지 방법이 있습니다. 첫 번째 방법은 생성자 중 하나를 사용하여 CTaskDialog::D oModal을 사용하여 생성자를 만들고 CTaskDialog 표시하는 것입니다. 두 번째 방법은 개체를 명시적으로 만들지 않고 표시 CTaskDialog 할 수 있는 정적 함수 CTaskDialog::ShowDialogCTaskDialog 사용하는 것입니다.

두 번째 생성자는 애플리케이션의 리소스 파일에서 데이터를 사용하여 명령 단추 컨트롤을 만듭니다. 리소스 파일의 문자열 테이블에는 연결된 문자열 ID가 있는 여러 문자열이 있습니다. 이 메서드는 nIDCommandControlsFirstnCommandControlsLast 사이에 문자열 테이블의 유효한 각 항목에 대한 명령 단추 컨트롤을 추가합니다. 이러한 명령 단추 컨트롤의 경우 문자열 테이블의 문자열은 컨트롤의 캡션 문자열 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();

CTaskDialog::D oModal

모달을 CTaskDialog 표시하고 만듭니다.

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

매개 변수

hParent
[in] 에 대한 부모 창입니다 CTaskDialog.

Return Value

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

설명

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();

CTaskDialog::GetCommonButtonCount

일반적인 단추 수를 검색합니다.

int GetCommonButtonCount() const;

Return Value

사용할 수 있는 일반적인 단추의 수입니다.

설명

일반적인 단추는 CTaskDialog::CTaskDialog에 제공하는 기본 단추입니다. CTaskDialog 클래스대화 상자의 아래쪽에 있는 단추를 표시합니다.

단추의 열거형 목록은 CommCtrl.h에 제공됩니다.

CTaskDialog::GetCommonButtonFlag

표준 Windows 단추를 CTaskDialog 클래스와 연결된 공통 단추 유형으로 변환합니다.

int GetCommonButtonFlag(int nButtonId) const;

매개 변수

nButtonId
[in] 표준 Windows 단추 값입니다.

Return Value

해당 공통 단추의 값입니다 CTaskDialog . 해당하는 공통 단추가 없으면 이 메서드는 0을 반환합니다.

CTaskDialog::GetCommonButtonId

CTaskDialog 클래스연결된 공통 단추 유형 중 하나를 표준 Windows 단추로 변환합니다.

int GetCommonButtonId(int nFlag);

매개 변수

nFlag
[in] 클래스와 연결된 공통 단추 형식입니다 CTaskDialog .

Return Value

해당 표준 Windows 단추의 값입니다. 해당 Windows 단추가 없으면 메서드는 0을 반환합니다.

CTaskDialog::GetOptions

CTaskDialog옵션 플래그를 반환합니다.

int GetOptions() const;

Return Value

에 대한 플래그입니다 CTaskDialog.

설명

CTaskDialog 클래스에서 사용할 수 있는 옵션에 대한 자세한 내용은 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();

CTaskDialog::GetSelectedCommandControlID

선택한 명령 단추 컨트롤을 반환합니다.

int GetSelectedCommandControlID() const;

Return Value

현재 선택한 명령 단추 컨트롤의 ID입니다.

설명

이 메서드를 사용하여 사용자가 선택한 명령 단추의 ID를 검색할 필요는 없습니다. 해당 ID는 CTaskDialog::D oModal 또는 CTaskDialog::ShowDialog에서 반환됩니다.

예시

// 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);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::GetSelectedRadioButtonID

선택한 라디오 단추를 반환합니다.

int GetSelectedRadioButtonID() const;

Return Value

선택한 라디오 단추의 ID입니다.

설명

사용자가 대화 상자를 닫은 후 이 메서드를 사용하여 선택한 라디오 단추를 검색할 수 있습니다.

예시

// 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);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::GetVerificationCheckboxState

확인 검사 상자의 상태를 검색합니다.

BOOL GetVerificationCheckboxState() const;

Return Value

검사 상자가 검사 경우 TRUE이고, 그렇지 않으면 FALSE입니다.

예시

// 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);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::IsCommandControlEnabled

명령 단추 컨트롤 또는 단추를 사용할 수 있는지 여부를 결정합니다.

BOOL IsCommandControlEnabled(int nCommandControlID) const;

매개 변수

nCommandControlID
[in] 테스트할 명령 단추 컨트롤 또는 단추의 ID입니다.

Return Value

컨트롤을 사용하도록 설정하면 TRUE이고, 그렇지 않으면 FALSE입니다.

설명

이 메서드를 사용하여 명령 단추 컨트롤과 클래스*의 공통 단추의 가용성을 CTaskDialog 확인할 수 있습니다.

nCommandControlID가 공통 CTaskDialog 단추 또는 명령 단추 컨트롤에 대한 유효한 식별자가 아닌 경우 이 메서드는 예외를 throw합니다.

예시

// 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);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::IsRadioButtonEnabled

라디오 단추를 사용할 수 있는지 여부를 결정합니다.

BOOL IsRadioButtonEnabled(int nRadioButtonID) const;

매개 변수

nRadioButtonID
[in] 테스트할 라디오 단추의 ID입니다.

Return Value

라디오 단추를 사용하도록 설정하면 TRUE이고, 그렇지 않으면 FALSE입니다.

설명

nRadioButtonID가 라디오 단추의 유효한 식별자가 아닌 경우 이 메서드는 예외를 throw합니다.

예시

// 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);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::IsSupported

애플리케이션을 실행하는 컴퓨터가 지원되는지 여부를 확인합니다 CTaskDialog.

static BOOL IsSupported();

Return Value

컴퓨터가 ;을 지원하는 경우 TRUE입니다 CTaskDialog. 그렇지 않으면 FALSE입니다.

설명

이 함수를 사용하여 런타임에 애플리케이션을 실행하는 컴퓨터가 클래스를 지원하는지 확인합니다 CTaskDialog . 컴퓨터에서 지원하지 CTaskDialog않는 경우 사용자에게 정보를 전달하는 다른 방법을 제공해야 합니다. 클래스를 지원하지 않는 컴퓨터에서 CTaskDialog 사용하려고 하면 애플리케이션이 충돌합니다 CTaskDialog .

예시

// 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);
}

CTaskDialog::LoadCommandControls

문자열 테이블의 데이터를 사용하여 명령 단추 컨트롤을 추가합니다.

void LoadCommandControls(
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast);

매개 변수

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

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

설명

이 메서드는 애플리케이션의 리소스 파일에서 데이터를 사용 하 여 명령 단추 컨트롤을 만듭니다. 리소스 파일의 문자열 테이블에는 연결된 문자열 ID가 있는 여러 문자열이 있습니다. 이 메서드를 사용하여 추가된 새 명령 단추 컨트롤은 컨트롤의 캡션 문자열과 컨트롤 ID의 문자열 ID를 사용합니다. 선택한 문자열 범위는 nIDCommandControlsFirst 및 nCommandControlsLast(포함)에서 제공됩니다. 범위에 빈 항목이 있는 경우 메서드는 해당 항목에 대한 명령 단추 컨트롤을 추가하지 않습니다.

기본적으로 새 명령 단추 컨트롤을 사용하도록 설정되며 권한 상승이 필요하지 않습니다.

예시

// 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);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::LoadRadioButtons

문자열 테이블의 데이터를 사용하여 라디오 단추 컨트롤을 추가합니다.

void LoadRadioButtons(
    int nIDRadioButtonsFirst,
    int nIDRadioButtonsLast);

매개 변수

nIDRadioButtonsFirst
[in] 첫 번째 라디오 단추의 문자열 ID입니다.

nIDRadioButtonsLast
[in] 마지막 라디오 단추의 문자열 ID입니다.

설명

이 메서드는 애플리케이션의 리소스 파일에서 데이터를 사용 하 여 라디오 단추를 만듭니다. 리소스 파일의 문자열 테이블에는 연결된 문자열 ID가 있는 여러 문자열이 있습니다. 이 메서드를 사용하여 추가된 새 라디오 단추는 라디오 단추의 캡션 문자열과 라디오 단추 ID의 문자열 ID를 사용합니다. 선택한 문자열 범위는 nIDRadioButtonsFirst 및 nRadioButtonsLast(포함)에서 제공됩니다. 범위에 빈 항목이 있는 경우 메서드는 해당 항목에 대한 라디오 단추를 추가하지 않습니다.

기본적으로 새 라디오 단추는 사용하도록 설정됩니다.

예시

// 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);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

포커스를 다른 CTaskDialog포커스로 전송합니다.

protected:
void NavigateTo(CTaskDialog& oTaskDialog) const;

매개 변수

oTaskDialog
[in] CTaskDialog 포커스를 받는 대상입니다.

설명

이 메서드는 oTaskDialog를 표시할 때 현재 CTaskDialog숨깁니다. oTaskDialog는 현재 CTaskDialog위치와 동일한 위치에 표시됩니다.

CTaskDialog::OnCommandControlClick

프레임워크는 사용자가 명령 단추 컨트롤을 클릭할 때 이 메서드를 호출합니다.

virtual HRESULT OnCommandControlClick(int nCommandControlID);

매개 변수

nCommandControlID
[in] 사용자가 선택한 명령 단추 컨트롤의 ID입니다.

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnCreate

프레임워크는 이 메서드를 만든 후 호출합니다 CTaskDialog.

virtual HRESULT OnCreate();

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnDestroy

프레임워크는 이 메서드를 삭제하기 직전에 호출합니다 CTaskDialog.

virtual HRESULT OnDestroy();

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnExpandButtonClick

프레임워크는 사용자가 확장 단추를 클릭할 때 이 메서드를 호출합니다.

virtual HRESULT OnExpandButtonClicked(BOOL bExpanded);

매개 변수

bExpanded
[in] 0이 아닌 값은 추가 정보가 표시됨을 나타냅니다. 0은 추가 정보가 숨겨져 있음을 나타냅니다.

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnHelp

프레임워크는 사용자가 도움을 요청할 때 이 메서드를 호출합니다.

virtual HRESULT OnHelp();

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnHyperlinkClick

프레임워크는 사용자가 하이퍼링크를 클릭할 때 이 메서드를 호출합니다.

virtual HRESULT OnHyperlinkClick(const CString& strHref);

매개 변수

strHref
[in] 하이퍼링크를 나타내는 문자열입니다.

Return Value

기본 구현은 S_OK 반환합니다.

설명

이 메서드는 S_OK 반환하기 전에 ShellExecute를 호출합니다.

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnInit

프레임워크는 초기화될 때 이 메서드를 CTaskDialog 호출합니다.

virtual HRESULT OnInit();

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnNavigatePage

프레임워크는 CTaskDialog::NavigateTo 메서드에 대한 응답으로 이 메서드를 호출합니다.

virtual HRESULT OnNavigatePage();

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnRadioButtonClick

프레임워크는 사용자가 라디오 단추 컨트롤을 선택할 때 이 메서드를 호출합니다.

virtual HRESULT OnRadioButtonClick(int nRadioButtonID);

매개 변수

nRadioButtonID
[in] 사용자가 클릭한 라디오 단추 컨트롤의 ID입니다.

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnTimer

프레임워크는 타이머가 만료되면 이 메서드를 호출합니다.

virtual HRESULT OnTimer(long lTime);

매개 변수

lTime
[in] 만든 시간 또는 타이머가 CTaskDialog 다시 설정된 이후의 시간(밀리초)입니다.

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::OnVerificationCheckboxClick

프레임워크는 사용자가 확인 검사 상자를 클릭할 때 이 메서드를 호출합니다.

virtual HRESULT OnVerificationCheckboxClick(BOOL bChecked);

매개 변수

bChecked
[in] TRUE는 확인 검사 상자가 선택되었음을 나타냅니다. FALSE는 그렇지 않음을 나타냅니다.

Return Value

기본 구현은 S_OK 반환합니다.

설명

파생 클래스에서 이 메서드를 재정의하여 사용자 지정 동작을 구현합니다.

CTaskDialog::RemoveAllCommandControls

에서 모든 명령 단추 컨트롤을 CTaskDialog제거합니다.

void RemoveAllCommandControls();

예시

// 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);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::RemoveAllRadioButtons

에서 모든 라디오 단추를 제거합니다 CTaskDialog.

void RemoveAllRadioButtons();

예시

// 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);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetCommandControlOptions

에 명령 단추 컨트롤을 CTaskDialog업데이트.

void SetCommandControlOptions(
    int nCommandControlID,
    BOOL bEnabled,
    BOOL bRequiresElevation = FALSE);

매개 변수

nCommandControlID
[in] 업데이트할 명령 컨트롤의 ID입니다.

bEnabled
[in] 지정한 명령 단추 컨트롤을 사용할 수 있는지 여부를 나타내는 부울 매개 변수입니다.

bRequiresElevation
[in] 지정된 명령 단추 컨트롤에 상승이 필요한지 여부를 나타내는 부울 매개 변수입니다.

설명

명령 단추 컨트롤이 클래스에 추가된 후 권한 상승이 필요한지 여부를 변경하려면 이 메서드를 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);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::SetCommonButtonOptions

UAC 권한 상승을 사용하도록 설정하고 요구하는 공통 단추의 하위 집합을 업데이트.

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

매개 변수

nDisabledButtonMask
[in] 사용하지 않도록 설정할 일반 단추에 대한 마스크입니다.

nElevationButtonMask
[in] 권한 상승이 필요한 일반 단추에 대한 마스크입니다.

설명

CTaskDialog::CTaskDialog 및 CTaskDialog::SetCommonButtons 메서드를 사용하여 CTaskDialog 클래스 인스턴스에 사용할 수 있는 공통 단추를 설정할 수 있습니다. CTaskDialog::SetCommonButtonOptions 에서는 새 공통 단추 추가를 지원하지 않습니다.

이 메서드를 사용하여 사용할 수 CTaskDialog없는 공통 단추를 사용하지 않도록 설정하거나 상승하는 경우 이 메서드는 ENSURE 매크로를 사용하여 예외를 throw합니다.

이 메서드는 이전에 사용하지 않도록 설정된 경우에도 nDisabledButtonMask에서 사용할 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();

CTaskDialog::SetCommonButtons

에 공통 단추를 추가합니다 CTaskDialog.

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

매개 변수

nButtonMask
[in] 에 추가할 단추의 마스크입니다 CTaskDialog.

nDisabledButtonMask
[in] 사용하지 않도록 설정할 단추의 마스크입니다.

nElevationButtonMask
[in] 권한 상승이 필요한 단추의 마스크입니다.

설명

클래스의 이 인스턴스에 대한 표시 창을 만든 후에는 이 메서드를 호출할 CTaskDialog 수 없습니다. 이 경우 이 메서드는 예외를 throw합니다.

nButtonMask표시된 단추는 이전에 에 추가된 모든 일반 단추를 재정의CTaskDialog합니다. nButtonMask표시된 단추만 사용할 수 있습니다.

nDisabledButtonMask 또는 nElevationButtonMask에 nButtonMask없는 단추가 포함된 경우 이 메서드는 ENSURE 매크로를 사용하여 예외를 throw합니다.

기본적으로 모든 일반 단추는 사용하도록 설정되며 권한 상승이 필요하지 않습니다.

예시

// 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();

CTaskDialog::SetContent

CTaskDialog콘텐츠를 업데이트.

void SetContent(const CString& strContent);

매개 변수

strContent
[in] 사용자에게 표시할 문자열입니다.

설명

클래스의 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();

CTaskDialog::SetDefaultCommandControl

기본 명령 단추 컨트롤을 지정합니다.

void SetDefaultCommandControl(int nCommandControlID);

매개 변수

nCommandControlID
[in] 기본값으로 사용할 명령 단추 컨트롤의 ID입니다.

설명

기본 명령 단추 컨트롤은 사용자에게 처음 표시될 때 CTaskDialog 선택된 컨트롤입니다.

이 메서드는 nCommandControlID지정된 명령 단추 컨트롤을 찾을 수 없는 경우 예외를 throw합니다.

예시

// 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);

taskDialog.AddCommandControl(201, L"First command button control");
taskDialog.AddCommandControl(202, L"Second command button control");
taskDialog.AddCommandControl(203, L"Third command button control");

// Show the CTaskDialog and remember how the user closed it.
int selection = taskDialog.DoModal();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // command button control.
   break;

case 202:
   // TODO: Place processing here for the second
   // command button control.
   break;

case 203:
   // TODO: Place processing here for the third
   // command button control.
   break;

default:
   break;
}

// Remove all the command controls so that we can use the same task
// dialog with new command button controls.
taskDialog.RemoveAllCommandControls();

taskDialog.AddCommandControl(301,
                             L"New first command button control");
taskDialog.AddCommandControl(302,
                             L"New second command button control should require elevation",
                             TRUE, TRUE);
taskDialog.AddCommandControl(303,
                             L"New third command button control should be disabled");

// Change the default command button control
taskDialog.SetDefaultCommandControl(302);

// Make sure the third option is disabled.
if (taskDialog.IsCommandControlEnabled(303))
{
   taskDialog.SetCommandControlOptions(303, FALSE);
}

taskDialog.DoModal();

switch (taskDialog.GetSelectedCommandControlID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the command button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllCommandControls();
taskDialog.LoadCommandControls(1001, 1005);

CTaskDialog::SetDefaultRadioButton

기본 라디오 단추를 지정합니다.

void SetDefaultRadioButton(int nRadioButtonID);

매개 변수

nRadioButtonID
[in] 기본값으로 사용할 라디오 단추의 ID입니다.

설명

기본 라디오 단추는 사용자에게 처음 표시될 때 CTaskDialog 선택된 단추입니다.

이 메서드는 nRadioButtonID지정된 라디오 단추를 찾을 수 없는 경우 예외를 throw합니다.

예시

// 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);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetDialogWidth

의 너비를 CTaskDialog조정합니다.

void SetDialogWidth(int nWidth = 0);

매개 변수

nWidth
[in] 대화 상자의 너비(픽셀)입니다.

설명

nWidth 매개 변수는 0보다 크거나 같아야 합니다. 그렇지 않으면 이 메서드는 예외를 throw합니다.

nWidth를 0으로 설정하면 이 메서드는 대화 상자를 기본 크기로 설정합니다.

예시

// 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();

CTaskDialog::SetExpansionArea

의 확장 영역을 CTaskDialog업데이트.

void SetExpansionArea(
    const CString& strExpandedInformation,
    const CString& strCollapsedLabel = _T(""),
    const CString& strExpandedLabel = _T(""));

매개 변수

strExpandedInformation
[in] 사용자가 확장 단추를 클릭할 CTaskDialog 때 대화 상자의 기본 본문에 표시되는 문자열입니다.

strCollapsedLabel
[in] 확장된 영역이 CTaskDialog 축소될 때 확장 단추 옆에 표시되는 문자열입니다.

strExpandedLabel
[in] 확장된 영역이 CTaskDialog 표시될 때 확장 단추 옆에 표시되는 문자열입니다.

설명

클래스의 CTaskDialog 확장 영역을 사용하면 사용자에게 추가 정보를 제공할 수 있습니다. 확장 영역은 제목 및 콘텐츠 문자열 바로 아래에 있는 기본 부분에 CTaskDialog있습니다.

CTaskDialog 처음 표시되면 확장된 정보가 표시되지 않고 확장 단추 옆에 놓 strCollapsedLabel 습니다. 사용자가 확장 단추를 CTaskDialog 클릭하면 strExpandedInformation이 표시되고 레이블이 strExpandedLabel변경됩니다.

예시

// 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();

CTaskDialog::SetFooterIcon

의 바닥글 아이콘을 CTaskDialog업데이트.

void SetFooterIcon(HICON hFooterIcon);
void SetFooterIcon(LPCWSTR lpszFooterIcon);

매개 변수

hFooterIcon
[in] 에 대한 새 아이콘입니다 CTaskDialog.

lpszFooterIcon
[in] 에 대한 새 아이콘입니다 CTaskDialog.

설명

바닥글 아이콘은 CTaskDialog 클래스아래쪽에 표시됩니다. 연결된 바닥글 텍스트가 있을 수 있습니다. CTaskDialog::SetFooterText를 사용하여 바닥글 텍스트를 변경할 수 있습니다.

이 메서드는 표시되거나 입력 매개 변수가 NULL인 경우 CTaskDialog ENSURE 매크로를 사용하여 예외를 throw합니다.

A는 CTaskDialog 바닥글 아이콘만 HICON 허용하거나 LPCWSTR 바닥글 아이콘으로 사용할 수 있습니다. 이는 생성자 또는 CTaskDialog::SetOptions에서 TDF_USE_HICON_FOOTER 옵션을 설정하여 구성됩니다. 기본적으로 바닥글 아이콘의 CTaskDialog 입력 형식으로 사용하도록 LPCWSTR 구성됩니다. 이 메서드는 부적절한 형식을 사용하여 아이콘을 설정하려고 하면 예외를 생성합니다.

예시

// 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();

CTaskDialog::SetFooterText

의 바닥글CTaskDialog에 텍스트를 업데이트.

void SetFooterText(const CString& strFooterText);

매개 변수

strFooterText
[in] 바닥글의 새 텍스트입니다.

설명

바닥글 아이콘은 바닥글의 아래쪽 CTaskDialog에 있는 바닥글 텍스트 옆에 나타납니다. CTaskDialog::SetFooterIcon사용하여 바닥글 아이콘을 변경할 수 있습니다.

예시

// 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();

CTaskDialog::SetMainIcon

의 기본 아이콘CTaskDialog을 업데이트.

void SetMainIcon(HICON hMainIcon);
void SetMainIcon(LPCWSTR lpszMainIcon);

매개 변수

hMainIcon
[in] 새 아이콘입니다.

lpszMainIcon
[in] 새 아이콘입니다.

설명

이 메서드는 표시되거나 입력 매개 변수가 NULL인 경우 CTaskDialog ENSURE 매크로를 사용하여 예외를 throw합니다.

A CTaskDialogHICON 기본 아이콘으로만 수락할 LPCWSTR 수 있습니다. 생성자 또는 CTaskDialog::SetOptions 메서드에서 TDF_USE_HICON_MAIN 옵션을 설정하여 구성할 수 있습니다 . 기본적으로 기본 CTaskDialog 아이콘의 입력 형식으로 사용하도록 LPCWSTR 구성됩니다. 이 메서드는 부적절한 형식을 사용하여 아이콘을 설정하려고 하면 예외를 생성합니다.

예시

// 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();

CTaskDialog::SetMainInstruction

의 기본 명령을 CTaskDialog업데이트.

void SetMainInstruction(const CString& strInstructions);

매개 변수

strInstructions
[in] 새 기본 명령입니다.

설명

클래스의 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();

CTaskDialog::SetOptions

에 대한 CTaskDialog옵션을 구성합니다.

void SetOptions(int nOptionFlag);

매개 변수

nOptionFlag
[in] 에 사용할 플래그 집합입니다 CTaskDialog.

설명

이 메서드는 에 대한 CTaskDialog모든 현재 옵션을 지웁니다. 현재 옵션을 유지하려면 먼저 CTaskDialog::GetOptions 를 사용하여 검색하고 설정하려는 옵션과 결합해야 합니다.

다음 표에서는 모든 유효한 옵션을 나열합니다.

이름 설명
TDF_ENABLE_HYPERLINKS 에서 하이퍼링크를 CTaskDialog사용하도록 설정합니다.
TDF_USE_HICON_MAIN CTaskDialog 기본 아이콘에 HICON 사용하도록 구성합니다. 대안은 .를 사용하는 것입니다 LPCWSTR.
TDF_USE_HICON_FOOTER CTaskDialog 바닥글 아이콘을 HICON 사용하도록 구성합니다. 대안은 .를 사용하는 것입니다 LPCWSTR.
TDF_ALLOW_DIALOG_CANCELLATION 취소 단추를 사용할 수 없는 경우에도 사용자가 키보드를 사용하거나 대화 상자의 오른쪽 위 모서리에 있는 아이콘을 사용하여 닫 CTaskDialog 을 수 있습니다. 이 플래그를 설정 하지 않고 취소 단추를 사용하도록 설정하지 않으면 Alt+F4, 이스케이프 키 또는 제목 표시줄의 닫기 단추를 사용하여 대화 상자를 닫을 수 없습니다.
TDF_USE_COMMAND_LINKS CTaskDialog 명령 단추 컨트롤을 사용하도록 구성합니다.
TDF_USE_COMMAND_LINKS_NO_ICON CTaskDialog 컨트롤 옆에 아이콘을 표시하지 않고 명령 단추 컨트롤을 사용하도록 구성합니다. TDF_USE_COMMAND_LINKS TDF_USE_COMMAND_LINKS_NO_ICON 재정의합니다.
TDF_EXPAND_FOOTER_AREA 확장 영역이 현재 확장되었음을 나타냅니다.
TDF_EXPANDED_BY_DEFAULT 확장 영역이 기본적으로 확장되는지 여부를 결정합니다.
TDF_VERIFICATION_FLAG_CHECKED 확인 검사 상자가 현재 선택되어 있음을 나타냅니다.
TDF_SHOW_PROGRESS_BAR 진행률 표시 CTaskDialog 줄을 표시하도록 구성합니다.
TDF_SHOW_MARQUEE_PROGRESS_BAR 진행률 표시줄을 선택 윤곽선 진행률 표시줄로 구성합니다. 이 옵션을 사용하도록 설정하면 예상되는 동작이 TDF_SHOW_PROGRESS_BAR 설정해야 합니다.
TDF_CALLBACK_TIMER CTaskDialog 콜백 간격이 약 200밀리초로 설정되었음을 나타냅니다.
TDF_POSITION_RELATIVE_TO_WINDOW CTaskDialog 부모 창을 기준으로 가운데에 배치되도록 구성합니다. 이 플래그를 CTaskDialog 사용하도록 설정하지 않으면 모니터를 기준으로 가운데에 배치됩니다.
TDF_RTL_LAYOUT 오른쪽에서 CTaskDialog 왼쪽으로 읽기 레이아웃을 구성합니다.
TDF_NO_DEFAULT_RADIO_BUTTON 라디오 단추가 나타날 때 선택되지 않음을 CTaskDialog 나타냅니다.
TDF_CAN_BE_MINIMIZED 사용자가 .를 최소화 CTaskDialog할 수 있도록 합니다. 이 옵션을 CTaskDialog 지원하려면 모달일 수 없습니다. MFC는 모덜리스 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();

CTaskDialog::SetProgressBarMarquee

대화 상자의 선택 윤곽 표시줄을 CTaskDialog 구성하고 대화 상자에 추가합니다.

void SetProgressBarMarquee(
    BOOL bEnabled = TRUE,
    int nMarqueeSpeed = 0);

매개 변수

bEnabled
[in] TRUE이면 선택 윤곽선이 활성화됩니다. FALSE를 사용하여 선택 윤곽 표시줄을 사용하지 않도록 설정하고 .에서 CTaskDialog제거합니다.

nMarqueeSpeed
[in] 선택 윤곽선의 속도를 나타내는 정수입니다.

설명

클래스의 기본 텍스트 아래에 선택 윤곽선이 CTaskDialog 나타납니다.

nMarqueeSpeed를 사용하여 선택 윤곽선의 속도를 설정합니다. 값이 클수록 속도가 느려집니다. nMarqueeSpeed의 경우 값이 0이면 Windows의 기본 속도로 선택 윤곽 표시줄이 이동합니다.

nMarqueeSpeed0보다 작은 경우 이 메서드는 ENSURE 매크로를 사용하여 예외를 throw합니다.

예시

// 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);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarPosition

진행률 표시줄의 위치를 조정합니다.

void SetProgressBarPosition(int nProgressPos);

매개 변수

nProgressPos
[in] 진행률 표시줄의 위치입니다.

설명

nProgressPos가 진행률 표시줄 범위에 없는 경우 이 메서드는 ENSURE 매크로를 사용하여 예외를 throw합니다. CTaskDialog::SetProgressBarRange를 사용하여 진행률 표시줄 범위를 변경할 수 있습니다.

예시

// 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);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarRange

진행률 표시줄의 범위를 조정합니다.

void SetProgressBarRange(
    int nRangeMin,
    int nRangeMax);

매개 변수

nRangeMin
[in] 진행률 표시줄의 하한입니다.

nRangeMax
[in] 진행률 표시줄의 상한입니다.

설명

진행률 표시줄의 위치는 nRangeMinnRangeMax기준으로 합니다. 예를 들어 nRangeMin이 50이고 nRangeMax가 100인 경우 75의 위치는 진행률 표시줄의 중간 위치입니다. CTaskDialog::SetProgressBarPosition을 사용하여 진행률 표시줄의 위치를 설정합니다.

진행률 표시줄을 표시하려면 TDF_SHOW_PROGRESS_BAR 옵션을 사용하도록 설정해야 하며 TDF_SHOW_MARQUEE_PROGRESS_BAR 사용하도록 설정하면 안 됩니다. 이 메서드는 자동으로 TDF_SHOW_PROGRESS_BAR 설정하고 TDF_SHOW_MARQUEE_PROGRESS_BAR 지웁니다. CTaskDialog::SetOptions를 사용하여 CTaskDialog 클래스이 인스턴스에 대한 옵션을 수동으로 변경합니다.

nRangeMin이 nRangeMax보다 작지 않은 경우 이 메서드는 ENSURE 매크로를 사용하여 예외를 throw합니다. 이 메서드는 이미 표시되고 선택 윤곽선 진행률 표시줄이 있는 경우에도 CTaskDialog 예외를 throw합니다.

예시

// 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);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetProgressBarState

진행률 표시줄의 상태를 설정하고 에 표시합니다 CTaskDialog.

void SetProgressBarState(int nState = PBST_NORMAL);

매개 변수

nState
[in] 진행률 표시줄의 상태입니다. 가능한 값은 설명 섹션을 참조하세요.

설명

이 메서드는 이미 표시되고 선택 윤곽선 진행률 표시줄이 CTaskDialog 있는 경우 ENSURE 매크로를 사용하여 예외를 throw합니다.

다음 표에서는 nState에 대한 가능한 값을 나열합니다. 이러한 모든 경우 진행률 표시줄은 지정된 중지 위치에 도달할 때까지 일반 색으로 채워집니다. 이때 상태에 따라 색이 변경됩니다.

이름 설명
PBST_NORMAL 진행률 표시줄이 CTaskDialog 채워지면 막대의 색이 변경되지 않습니다. 기본적으로 일반 색은 녹색입니다.
PBST_ERROR 진행률 표시줄이 채워지면 막대의 색이 오류 색으로 변경됩니다 CTaskDialog . 기본적으로 빨간색입니다.
PBST_PAUSED 진행률 표시줄이 CTaskDialog 채워지면 막대의 색이 일시 중지된 색으로 변경됩니다. 기본적으로 노란색입니다.

CTaskDialog::SetProgressBarPosition을 사용하여 진행률 표시줄이 중지되는 위치를 설정할 수 있습니다.

예시

// 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);

// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();

taskDialog.DoModal();

// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();

taskDialog.DoModal();

CTaskDialog::SetRadioButtonOptions

라디오 단추를 사용하거나 사용하지 않도록 설정합니다.

void SetRadioButtonOptions(
    int nRadioButtonID,
    BOOL bEnabled);

매개 변수

nRadioButtonID
[in] 라디오 단추 컨트롤의 ID입니다.

bEnabled
[in] TRUE이면 라디오 단추를 사용하도록 설정합니다. FALSE로 라디오 단추를 사용하지 않도록 설정합니다.

설명

nRadioButtonID가 라디오 단추의 유효한 ID가 아닌 경우 이 메서드는 ENSURE 매크로를 사용하여 예외를 throw합니다.

예시

// 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);

taskDialog.AddRadioButton(201, L"First option");
taskDialog.AddRadioButton(202, L"Second option");
taskDialog.AddRadioButton(203, L"Third option");

taskDialog.DoModal();
int selection = taskDialog.GetSelectedRadioButtonID();

switch (selection)
{
case 201:
   // TODO: Place processing here for the first
   // radio button.
   break;

case 202:
   // TODO: Place processing here for the second
   // radio button.
   break;

case 203:
   // TODO: Place processing here for the third
   // radio button.
   break;

default:
   break;
}

// Remove all the radio buttons so that we can use the same task
// dialog with new radio buttons.
taskDialog.RemoveAllRadioButtons();

taskDialog.AddRadioButton(301, L"New first option");
taskDialog.AddRadioButton(302, L"New second option");
taskDialog.AddRadioButton(303,
                          L"New third option should be disabled");

// Change the default radio button to the second option
taskDialog.SetDefaultRadioButton(302);

// Make sure the third option is disabled.
if (taskDialog.IsRadioButtonEnabled(303))
{
   taskDialog.SetRadioButtonOptions(303, FALSE);
}

taskDialog.DoModal();
selection = taskDialog.GetSelectedRadioButtonID();

switch (taskDialog.GetSelectedRadioButtonID())
{
case 301:
   // TODO: Place processing here for new first
   // command button control.
   break;

case 302:
   // TODO: Place processing here for new second
   // command button control.
   break;

case 303:
   // TODO: Place processing here for the new third
   // command button control.
   break;

default:
   break;
}

// Remove all the radio button controls and add new ones from
// the string table resource.
taskDialog.RemoveAllRadioButtons();
taskDialog.LoadRadioButtons(1001, 1005);

CTaskDialog::SetVerificationCheckbox

확인 검사 상자의 검사 상태를 설정합니다.

void SetVerificationCheckbox(BOOL bChecked);

매개 변수

bChecked
[in] TRUE이면 확인 검사 상자가 표시될 때 CTaskDialog 선택됩니다. 표시될 때 CTaskDialog 확인 검사 상자를 선택 취소하려면 FALSE입니다.

예시

// 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);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::SetVerificationCheckboxText

확인 검사 상자의 오른쪽에 표시되는 텍스트를 설정합니다.

void SetVerificationCheckboxText(CString& strVerificationText);

매개 변수

strVerificationText
[in] 확인 검사 상자 옆에 이 메서드가 표시하는 텍스트입니다.

설명

이 메서드는 클래스의 이 인스턴스가 이미 표시된 경우 ENSURE 매크로를 사용하여 예외를 CTaskDialog throw합니다.

예시

// 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);

// Add the verification checkbox and set the default state.
taskDialog.SetVerificationCheckboxText(L"Remember your selection.");
taskDialog.SetVerificationCheckbox(false);

taskDialog.DoModal();

if (taskDialog.GetVerificationCheckboxState())
{
   // TODO: Write settings of the task dialog to the registry
}

CTaskDialog::SetWindowTitle

의 제목을 CTaskDialog설정합니다.

void SetWindowTitle(CString& strWindowTitle);

매개 변수

strWindowTitle
[in] 의 새 제목입니다 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();

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(""));

매개 변수

strContent
[in] 의 내용에 사용할 문자열입니다 CTaskDialog.

strMainInstruction
[in] 의 기본 명령입니다CTaskDialog.

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

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

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

nCommonButtons
[in] 에 추가할 단추의 마스크입니다 CTaskDialog.

nTaskDialogOptions
[in] 에 사용할 옵션 집합입니다 CTaskDialog.

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

Return Value

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

설명

이 정적 메서드를 사용하면 코드에서 개체를 명시적으로 만들지 않고도 클래스의 CTaskDialog 인스턴스를 CTaskDialog 만들 수 있습니다. 개체가 없 CTaskDialog 으므로 이 메서드를 사용하여 사용자에게 표시하는 경우 다른 메서드 CTaskDialogCTaskDialog 호출할 수 없습니다.

이 메서드는 애플리케이션의 리소스 파일에서 데이터를 사용 하 여 명령 단추 컨트롤을 만듭니다. 리소스 파일의 문자열 테이블에는 연결된 문자열 ID가 있는 여러 문자열이 있습니다. 이 메서드는 nIDCommandControlsFirstnCommandControlsLast 사이에 문자열 테이블의 유효한 각 항목에 대한 명령 단추 컨트롤을 추가합니다. 이러한 명령 단추 컨트롤의 경우 문자열 테이블의 문자열은 컨트롤의 캡션 문자열 ID는 컨트롤의 ID입니다.

유효한 옵션 목록은 CTaskDialog::SetOptions를 참조하세요.

CTaskDialog 사용자가 공통 단추, 명령 링크 컨트롤을 선택하거나 닫으면 닫힙니다CTaskDialog. 반환 값은 사용자가 대화 상자를 닫은 방법을 나타내는 식별자입니다.

예시

// 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);
}

CTaskDialog::TaskDialogCallback

프레임워크는 다양한 Windows 메시지에 대한 응답으로 이 메서드를 호출합니다.

friend:
HRESULT TaskDialogCallback(
    HWND hWnd,
    UINT uNotification,
    WPARAM wParam,
    LPARAM lParam,
    LONG_PTR dwRefData);

매개 변수

hwnd
[in] 에 대한 구조체 m_hWnd 에 대한 핸들입니다 CTaskDialog.

uNotification
[in] 생성된 메시지를 지정하는 알림 코드입니다.

wParam
[in] 메시지에 대한 자세한 정보입니다.

lParam
[in] 메시지에 대한 자세한 정보입니다.

dwRefData
[in] 콜백 메시지가 적용되는 개체에 대한 포인터 CTaskDialog 입니다.

Return Value

특정 알림 코드에 따라 다릅니다. 자세한 내용은 설명 부분을 참조하세요.

설명

기본 구현은 TaskDialogCallback 특정 메시지를 처리한 다음 CTaskDialog 클래스의 적절한 On 메서드를 호출합니다. 예를 들어 TDN_BUTTON_CLICKED 메시지에 TaskDialogCallback 대한 응답으로 CTaskDialog::OnCommandControlClick을 호출합니다.

wParamlParam값은 생성된 특정 메시지에 따라 달라집니다. 이러한 값 중 하나 또는 둘 다 비어 있을 수 있습니다. 다음 표에는 지원되는 기본 알림과 wParam 및 lParam값이 나타내는 내용이 나와 있습니다. 파생 클래스에서 이 메서드를 재정의하는 경우 다음 표의 각 메시지에 대한 콜백 코드를 구현해야 합니다.

알림 메시지 wParam lParam
TDN_CREATED 사용되지 않습니다. 사용되지 않습니다.
TDN_NAVIGATED 사용되지 않습니다. 사용되지 않습니다.
TDN_BUTTON_CLICKED 명령 단추 컨트롤 ID입니다. 사용되지 않습니다.
TDN_HYPERLINK_CLICKED 사용되지 않습니다. 링크를 포함하는 LPCWSTR 구조체입니다.
TDN_TIMER 만든 시간 또는 타이머가 CTaskDialog 다시 설정된 이후의 시간(밀리초)입니다. 사용되지 않습니다.
TDN_DESTROYED 사용되지 않습니다. 사용되지 않습니다.
TDN_RADIO_BUTTON_CLICKED 라디오 단추 ID입니다. 사용되지 않습니다.
TDN_DIALOG_CONSTRUCTED 사용되지 않습니다. 사용되지 않습니다.
TDN_VERIFICATION_CLICKED 검사 상자가 검사 1이면 0입니다. 사용되지 않습니다.
TDN_HELP 사용되지 않습니다. 사용되지 않습니다.
TDN_EXPANDO_BUTTON_CLICKED 확장 영역이 축소되면 0이고, 확장 텍스트가 표시되는 경우 0이 아닌 값입니다. 사용되지 않습니다.

참고 항목

클래스
CObject 클래스
계층 구조 차트
연습: 애플리케이션에 CTaskDialog 추가