Compartilhar via


Classe CTaskDialog

Uma caixa de diálogo pop-up que funciona como uma caixa de mensagem, mas pode exibir informações adicionais para o usuário. A CTaskDialog também inclui a funcionalidade para coletar informações do usuário.

Sintaxe

class CTaskDialog : public CObject

Membros

Construtores

Nome Descrição
CTaskDialog::CTaskDialog Constrói um objeto CTaskDialog.

Métodos

Nome Descrição
CTaskDialog::AddCommandControl Adiciona um controle de botão de comando à CTaskDialog.
CTaskDialog::AddRadioButton Adiciona um botão de opção à CTaskDialog.
CTaskDialog::ClickCommandControl Clica em um controle de botão de comando ou botão comum programaticamente.
CTaskDialog::ClickRadioButton Clica em um botão de opção programaticamente.
CTaskDialog::DoModal Exibe o CTaskDialog.
CTaskDialog::GetCommonButtonCount Recupera o número de botões comuns disponíveis.
CTaskDialog::GetCommonButtonFlag Converte um botão padrão do Windows no tipo de botão comum associado à classe CTaskDialog.
CTaskDialog::GetCommonButtonId Converte um dos tipos de botão comuns associado à classe CTaskDialog em um botão padrão do Windows.
CTaskDialog::GetOptions Retorna os sinalizadores de opção para essa CTaskDialog.
CTaskDialog::GetSelectedCommandControlID Retorna o controle de botão de comando selecionado.
CTaskDialog::GetSelectedRadioButtonID Retorna o botão de opção selecionado.
CTaskDialog::GetVerificationCheckboxState Recupera o estado da caixa de seleção de verificação.
CTaskDialog::IsCommandControlEnabled Determina se um controle de botão de comando ou um botão comum está habilitado.
CTaskDialog::IsRadioButtonEnabled Determina se um botão de opção está habilitado.
CTaskDialog::IsSupported Determina se o computador que está executando o aplicativo dá suporte à CTaskDialog.
CTaskDialog::LoadCommandControls Adiciona controles de botão de comando usando dados da tabela de cadeia de caracteres.
CTaskDialog::LoadRadioButtons Adiciona botões de opção usando dados da tabela de cadeia de caracteres.
CTaskDialog::NavigateTo Transfere o foco para outra CTaskDialog.
CTaskDialog::OnCommandControlClick A estrutura chama esse método quando o usuário clica em um controle de botão de comando.
CTaskDialog::OnCreate A estrutura chama esse método depois de criar a CTaskDialog.
CTaskDialog::OnDestroy A estrutura chama esse método imediatamente antes de destruir a CTaskDialog.
CTaskDialog::OnExpandButtonClick A estrutura chama esse método quando o usuário clica no botão de expansão.
CTaskDialog::OnHelp A estrutura chama esse método quando o usuário solicita ajuda.
CTaskDialog::OnHyperlinkClick A estrutura chama esse método quando o usuário clica em um hiperlink.
CTaskDialog::OnInit A estrutura chama esse método quando a CTaskDialog é inicializada.
CTaskDialog::OnNavigatePage A estrutura chama esse método quando o usuário move o foco em relação aos controles na CTaskDialog.
CTaskDialog::OnRadioButtonClick A estrutura chama esse método quando o usuário seleciona um controle de botão de opção.
CTaskDialog::OnTimer A estrutura chama esse método quando o temporizador expira.
CTaskDialog::OnVerificationCheckboxClick A estrutura chama esse método quando o usuário clica na caixa de seleção de verificação.
CTaskDialog::RemoveAllCommandControls Remove todos os controles de comando da CTaskDialog.
CTaskDialog::RemoveAllRadioButtons Remove todos os botões de opção da CTaskDialog.
CTaskDialog::SetCommandControlOptions Atualiza um controle de botão de comando na CTaskDialog.
CTaskDialog::SetCommonButtonOptions Atualiza um subconjunto de botões comuns a serem habilitados e exigir elevação de UAC.
CTaskDialog::SetCommonButtons Adiciona botões comuns à CTaskDialog.
CTaskDialog::SetContent Atualiza o conteúdo da CTaskDialog.
CTaskDialog::SetDefaultCommandControl Especifica o controle de botão de comando padrão.
CTaskDialog::SetDefaultRadioButton Especifica o botão de opção padrão.
CTaskDialog::SetDialogWidth Ajusta a largura da CTaskDialog.
CTaskDialog::SetExpansionArea Atualiza a área de expansão da CTaskDialog.
CTaskDialog::SetFooterIcon Atualiza o ícone de rodapé da CTaskDialog.
CTaskDialog::SetFooterText Atualiza o texto no rodapé da CTaskDialog.
CTaskDialog::SetMainIcon Atualiza o ícone principal da CTaskDialog.
CTaskDialog::SetMainInstruction Atualiza a instrução principal da CTaskDialog.
CTaskDialog::SetOptions Configura as opções para a CTaskDialog.
CTaskDialog::SetProgressBarMarquee Configura uma barra de letreiro para a CTaskDialog e a adiciona à caixa de diálogo.
CTaskDialog::SetProgressBarPosition Ajusta a posição da barra de progresso.
CTaskDialog::SetProgressBarRange Ajusta o intervalo da barra de progresso.
CTaskDialog::SetProgressBarState Define o estado da barra de progresso e exibe-o na CTaskDialog.
CTaskDialog::SetRadioButtonOptions Habilita ou desabilita um botão de opção.
CTaskDialog::SetVerificationCheckbox Define o estado marcado da caixa de seleção de verificação.
CTaskDialog::SetVerificationCheckboxText Define o texto no lado direito da caixa de seleção de verificação.
CTaskDialog::SetWindowTitle Define o título do CTaskDialog.
CTaskDialog::ShowDialog Cria e exibe um CTaskDialog.
CTaskDialog::TaskDialogCallback A estrutura chama isso em resposta a várias mensagens do Windows.

Membros de dados

Nome Descrição
m_aButtons A matriz de controles de botão de comando para a CTaskDialog.
m_aRadioButtons A matriz de controles de botão de opção para a CTaskDialog.
m_bVerified TRUE indica que a caixa de seleção de verificação está marcada; FALSE indica que está desmarcada.
m_footerIcon O ícone no rodapé da CTaskDialog.
m_hWnd Um identificador para a janela da CTaskDialog.
m_mainIcon O ícone principal da CTaskDialog.
m_nButtonDisabled Uma máscara que indica quais dos botões comuns estão desabilitados.
m_nButtonElevation Uma máscara que indica quais dos botões comuns exigem elevação de UAC.
m_nButtonId A ID do controle de botão de comando selecionado.
m_nCommonButton Uma máscara que indica quais dos botões comuns são exibidos na CTaskDialog.
m_nDefaultCommandControl A ID do controle de botão de comando que é selecionado quando a CTaskDialog é exibida.
m_nDefaultRadioButton A ID do controle de botão de opção que é selecionado quando a CTaskDialog é exibida.
m_nFlags Uma máscara que indica as opções para a CTaskDialog.
m_nProgressPos A posição atual da barra de progresso. Esse valor deve estar entre m_nProgressRangeMin e m_nProgressRangeMax.
m_nProgressRangeMax O valor máximo para a barra de progresso.
m_nProgressRangeMin O valor mínimo para a barra de progresso.
m_nProgressState O estado da barra de progresso. Para obter mais informações, confira CTaskDialog::SetProgressBarState.
m_nRadioId A ID do controle de botão de opção selecionado.
m_nWidth A largura da CTaskDialog em pixels.
m_strCollapse A cadeia de caracteres que a CTaskDialog exibe à direita da caixa de expansão quando as informações expandidas estão ocultas.
m_strContent O valor da cadeia de caracteres da CTaskDialog.
m_strExpand A cadeia de caracteres que a CTaskDialog exibe à direita da caixa de expansão quando as informações expandidas são exibidas.
m_strFooter O rodapé do CTaskDialog.
m_strInformation As informações expandidas para a CTaskDialog.
m_strMainInstruction A instrução principal da CTaskDialog.
m_strTitle O título do CTaskDialog.
m_strVerification A cadeia de caracteres que a CTaskDialog exibe à direita da caixa de seleção de verificação.

Comentários

A classe CTaskDialog substitui a caixa de mensagem padrão do Windows e tem funcionalidade adicional, como novos controles, para coletar informações do usuário. Essa classe está na biblioteca MFC no Visual Studio 2010 e posterior. A CTaskDialog está disponível a partir do Windows Vista. As versões anteriores do Windows não podem exibir o objeto CTaskDialog. Use CTaskDialog::IsSupported para determinar em runtime se o usuário atual pode exibir a caixa de diálogo da tarefa. A caixa de mensagem padrão do Windows ainda tem suporte.

A CTaskDialog está disponível somente quando você compila seu aplicativo usando a biblioteca Unicode.

A CTaskDialog tem dois tipos de construtores diferentes. Um construtor permite que você especifique dois botões de comando e um máximo de seis controles de botão regulares. É possível adicionar mais botões de comando depois de criar a CTaskDialog. O segundo construtor não dá suporte a botões de comando, mas você pode adicionar um número ilimitado de controles de botão regulares. Para obter mais informações sobre os construtores, confira CTaskDialog::CTaskDialog.

A imagem a seguir mostra um exemplo CTaskDialog para ilustrar a localização de alguns dos controles.

Example of CTaskDialog.
Exemplo de CTaskDialog

Requisitos

Sistema operacional mínimo necessário: Windows Vista

Cabeçalho: afxtaskdialog.h

CTaskDialog::AddCommandControl

Adiciona um novo controle de botão de comando à CTaskDialog.

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

Parâmetros

nCommandControlID
[in] O número de identificação do controle de comando.

strCaption
[in] A cadeia de caracteres que a CTaskDialog exibe para o usuário. Use essa cadeia de caracteres para explicar a finalidade do comando.

bEnabled
[in] Um parâmetro booliano que indica se o novo botão está habilitado ou desabilitado.

bRequiresElevation
[in] Um parâmetro booliano que indica se um comando requer elevação.

Comentários

A CTaskDialog Class pode exibir um número ilimitado de controles de botão de comando. No entanto, se uma CTaskDialog exibe todos os controles de botão de comando, ela poderá exibir no máximo seis botões. Se uma CTaskDialog não tiver controles de botão de comando, ele poderá exibir um número ilimitado de botões.

Quando o usuário seleciona um controle de botão de comando, a CTaskDialog fecha. Se o aplicativo exibir a caixa de diálogo usando CTaskDialog::DoModal, DoModal retornará a nCommandControlID do controle de botão de comando selecionado.

Exemplo

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

Adiciona um botão de opção à CTaskDialog.

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

Parâmetros

nRadioButtonID
[in] O número de identificação do botão de opção.

strCaption
[in] A cadeia de caracteres que CTaskDialog exibe ao lado do botão de opção.

bEnabled
[in] Um parâmetro booliano que indica se o botão de opção está habilitado.

Comentários

Os botões de opção da Classe CTaskDialog permitem que você colete informações do usuário. Use a função CTaskDialog::GetSelectedRadioButtonID para determinar qual botão de opção será selecionado.

A CTaskDialog não exige que os parâmetros nRadioButtonID sejam exclusivos para cada botão de opção. No entanto, você poderá ter um comportamento inesperado se não usar um identificador distinto para cada botão de opção.

Exemplo

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

Clica em um controle de botão de comando ou botão comum programaticamente.

protected:
void ClickCommandControl(int nCommandControlID) const;

Parâmetros

nCommandControlID
[in] A ID do comando do controle a ser clicado.

Comentários

Esse método gera a mensagem do Windows TDM_CLICK_BUTTON.

CTaskDialog::ClickRadioButton

Clica em um botão de opção programaticamente.

protected:
void ClickRadioButton(int nRadioButtonID) const;

Parâmetros

nRadioButtonID
[in] A ID do botão de opção a ser clicado.

Comentários

Esse método gera a mensagem do Windows TDM_CLICK_RADIO_BUTTON.

CTaskDialog::CTaskDialog

Cria uma instância da Classe 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(""));

Parâmetros

strContent
[in] A cadeia de caracteres a ser usada para o conteúdo da CTaskDialog.

strMainInstruction
[in] A instrução principal da CTaskDialog.

strTitle
[in] O título da CTaskDialog.

nCommonButtons
[in] Uma máscara dos botões comuns a serem adicionados à CTaskDialog.

nTaskDialogOptions
[in] O conjunto de opções a ser usado para a CTaskDialog.

strFooter
[in] A cadeia de caracteres a ser usada como rodapé.

nIDCommandControlsFirst
[in] A ID da cadeia de caracteres do primeiro comando.

nIDCommandControlsLast
[in] A ID da cadeia de caracteres do último comando.

Comentários

Há duas maneiras de adicionar uma CTaskDialog ao seu aplicativo. A primeira maneira é usar um dos construtores para criar uma CTaskDialog e exibi-la usando CTaskDialog::DoModal. A segunda maneira é usar a função estática CTaskDialog::ShowDialog, que permite exibir uma CTaskDialog sem criar explicitamente um CTaskDialog objeto.

O segundo construtor cria controles de botão de comando usando dados do arquivo de recurso do aplicativo. A tabela de cadeia de caracteres no arquivo de recurso tem várias cadeias de caracteres com IDs de cadeia de caracteres associadas. Esse método adiciona um controle de botão de comando para cada entrada válida na tabela de cadeia de caracteres entre nIDCommandControlsFirst e nCommandControlsLast, inclusive. Para esses controles de botão de comando, a cadeia de caracteres na tabela de cadeia de caracteres é a legenda do controle e a ID da cadeia de caracteres é a ID do controle.

Confira CTaskDialog::SetOptions para ver uma lista de opções válidas.

Exemplo

// 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::DoModal

Exibe a CTaskDialog e a torna modal.

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

Parâmetros

hParent
[in] A janela pai para a CTaskDialog.

Valor de Devolução

Um inteiro que corresponde à seleção feita pelo usuário.

Comentários

Exibe essa instância da CTaskDialog. Em seguida, o aplicativo aguarda o usuário fechar a caixa de diálogo.

A CTaskDialog fecha quando o usuário seleciona um botão comum, um controle de link de comando ou fecha a CTaskDialog. O valor retornado é o identificador que indica como o usuário fechou a caixa de diálogo.

Exemplo

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

Recupera o número de botões comuns.

int GetCommonButtonCount() const;

Valor de Devolução

O número de botões comuns disponíveis.

Comentários

Os botões comuns são os botões padrão que você fornece à CTaskDialog::CTaskDialog. A Classe CTaskDialog exibe os botões na parte inferior da caixa de diálogo.

A lista enumerada de botões é fornecida em CommCtrl.h.

CTaskDialog::GetCommonButtonFlag

Converte um botão padrão do Windows no tipo de botão comum associado à Classe CTaskDialog.

int GetCommonButtonFlag(int nButtonId) const;

Parâmetros

nButtonId
[in] O valor do botão padrão do Windows.

Valor de Devolução

O valor do botão comum CTaskDialog correspondente. Se não houver um botão comum correspondente, esse método retornará 0.

CTaskDialog::GetCommonButtonId

Converte um dos tipos de botão comum associado à Classe CTaskDialog em um botão padrão do Windows.

int GetCommonButtonId(int nFlag);

Parâmetros

nFlag
[in] O tipo de botão comum associado à classe CTaskDialog.

Valor de Devolução

O valor do botão padrão do Windows correspondente. Se não houver nenhum botão do Windows correspondente, o método retornará 0.

CTaskDialog::GetOptions

Retorna os sinalizadores de opção para essa CTaskDialog.

int GetOptions() const;

Valor de Devolução

Os sinalizadores para a CTaskDialog.

Comentários

Para obter mais informações sobre as opções disponíveis para a Classe CTaskDialog, consulte CTaskDialog::SetOptions.

Exemplo

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

Retorna o controle de botão de comando selecionado.

int GetSelectedCommandControlID() const;

Valor de Devolução

A ID do controle de botão de comando selecionado atualmente.

Comentários

Não é necessário usar esse método para recuperar a ID do botão de comando selecionado pelo usuário. Essa ID é retornada por CTaskDialog::DoModal ou CTaskDialog::ShowDialog.

Exemplo

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

Retorna o botão de opção selecionado.

int GetSelectedRadioButtonID() const;

Valor de Devolução

A ID do botão de opção selecionado.

Comentários

Você pode usar esse método depois que o usuário fechar a caixa de diálogo para recuperar o botão de opção selecionado.

Exemplo

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

Recupera o estado da caixa de seleção de verificação.

BOOL GetVerificationCheckboxState() const;

Valor de Devolução

TRUE se a caixa de seleção estiver marcada; FALSE se estiver desmarcada.

Exemplo

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

Determina se um controle de botão de comando ou botão está habilitado.

BOOL IsCommandControlEnabled(int nCommandControlID) const;

Parâmetros

nCommandControlID
[in] A ID do botão ou controle de botão de comando a ser testado.

Valor de Devolução

TRUE se o controle estiver habilitado; FALSE se estiver desabilitado.

Comentários

É possível usar esse método para determinar a disponibilidade dos controles de botão de comando e os botões comuns da Classe* CTaskDialog.

Se nCommandControlID não for um identificador válido para um botão comum CTaskDialog ou um controle de botão de comando, esse método gerará uma exceção.

Exemplo

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

Determina se um botão de opção está habilitado.

BOOL IsRadioButtonEnabled(int nRadioButtonID) const;

Parâmetros

nRadioButtonID
[in] A ID do botão de opção a ser testado.

Valor de Devolução

TRUE se o botão de opção estiver habilitado; FALSE se estiver desabilitado.

Comentários

Se nRadioButtonID não for um identificador válido para um botão de opção, esse método gerará uma exceção.

Exemplo

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

Determina se o computador que está executando o aplicativo dá suporte à CTaskDialog.

static BOOL IsSupported();

Valor de Devolução

TRUE se o computador der suporte à CTaskDialog; FALSE caso contrário.

Comentários

Use essa função para determinar em runtime se o computador que está executando o aplicativo dá suporte à classe CTaskDialog. Se o computador não der suporte à CTaskDialog, você deverá fornecer outro método de comunicação de informações ao usuário. O aplicativo falhará se tentar usar uma CTaskDialog em um computador que não dê suporte à classe CTaskDialog.

Exemplo

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

Adiciona controles de botão de comando usando dados da tabela de cadeia de caracteres.

void LoadCommandControls(
    int nIDCommandControlsFirst,
    int nIDCommandControlsLast);

Parâmetros

nIDCommandControlsFirst
[in] A ID da cadeia de caracteres do primeiro comando.

nIDCommandControlsLast
[in] A ID da cadeia de caracteres do último comando.

Comentários

Esse método cria controles de botão de comando usando dados do arquivo de recurso do aplicativo. A tabela de cadeia de caracteres no arquivo de recurso tem várias cadeias de caracteres com IDs de cadeia de caracteres associadas. Novos controles de botão de comando adicionados usando esse método usam a cadeia de caracteres para a legenda do controle e a ID da cadeia de caracteres para a ID do controle. O intervalo das cadeias de caracteres selecionadas é fornecido por nIDCommandControlsFirst e nCommandControlsLast, inclusive. Se houver uma entrada vazia no intervalo, o método não adicionará um controle de botão de comando para essa entrada.

Por padrão, novos controles de botão de comando são habilitados e não exigem elevação.

Exemplo

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

Adiciona controles de botão de opção usando dados da tabela de cadeia de caracteres.

void LoadRadioButtons(
    int nIDRadioButtonsFirst,
    int nIDRadioButtonsLast);

Parâmetros

nIDRadioButtonsFirst
[in] A ID da cadeia de caracteres do primeiro botão de opção.

nIDRadioButtonsLast
[in] A ID da cadeia de caracteres do último botão de opção.

Comentários

Esse método cria botões de opção usando dados do arquivo de recurso do aplicativo. A tabela de cadeia de caracteres no arquivo de recurso tem várias cadeias de caracteres com IDs de cadeia de caracteres associadas. Novos botões de opção adicionados usando esse método usam a cadeia de caracteres para a legenda do botão de opção e a ID da cadeia de caracteres para a ID do botão de opção. O intervalo das cadeias de caracteres selecionadas é fornecido por nIDRadioButtonsFirst e nRadioButtonsLast, inclusive. Se houver uma entrada vazia no intervalo, o método não adicionará um botão de opção para essa entrada.

Por padrão, novos botões de opção são habilitados.

Exemplo

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

Transfere o foco para outra CTaskDialog.

protected:
void NavigateTo(CTaskDialog& oTaskDialog) const;

Parâmetros

oTaskDialog
[in] A CTaskDialog que recebe o foco.

Comentários

Esse método oculta a CTaskDialog atual quando exibe o oTaskDialog. O oTaskDialog é exibido no mesmo local que a CTaskDialog atual.

CTaskDialog::OnCommandControlClick

A estrutura chama esse método quando o usuário clica em um controle de botão de comando.

virtual HRESULT OnCommandControlClick(int nCommandControlID);

Parâmetros

nCommandControlID
[in] A ID do controle de botão de comando selecionado pelo usuário.

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnCreate

A estrutura chama esse método depois de criar a CTaskDialog.

virtual HRESULT OnCreate();

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnDestroy

A estrutura chama esse método imediatamente antes de destruir a CTaskDialog.

virtual HRESULT OnDestroy();

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnExpandButtonClick

A estrutura chama esse método quando o usuário clica no botão de expansão.

virtual HRESULT OnExpandButtonClicked(BOOL bExpanded);

Parâmetros

bExpanded
[in] Um valor diferente de zero indica que as informações extras são exibidas; 0 indica que as informações extras estão ocultas.

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnHelp

A estrutura chama esse método quando o usuário solicita ajuda.

virtual HRESULT OnHelp();

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnHyperlinkClick

A estrutura chama esse método quando o usuário clica em um hiperlink.

virtual HRESULT OnHyperlinkClick(const CString& strHref);

Parâmetros

strHref
[in] Uma cadeia de caracteres que representa o hiperlink.

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Esse método chama ShellExecute antes de retornar S_OK.

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnInit

A estrutura chama esse método quando a CTaskDialog é inicializada.

virtual HRESULT OnInit();

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnNavigatePage

A estrutura chama esse método em resposta ao método CTaskDialog::NavigateTo.

virtual HRESULT OnNavigatePage();

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnRadioButtonClick

A estrutura chama esse método quando o usuário seleciona um controle de botão de opção.

virtual HRESULT OnRadioButtonClick(int nRadioButtonID);

Parâmetros

nRadioButtonID
[in] A ID do controle do botão de opção que o usuário clicou.

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnTimer

A estrutura chama esse método quando o temporizador expira.

virtual HRESULT OnTimer(long lTime);

Parâmetros

lTime
[in] Tempo em milissegundos desde que a CTaskDialog foi criada ou o temporizador foi redefinido.

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::OnVerificationCheckboxClick

A estrutura chama esse método quando o usuário clica na caixa de seleção de verificação.

virtual HRESULT OnVerificationCheckboxClick(BOOL bChecked);

Parâmetros

bChecked
[in] TRUE indica que a caixa de seleção de verificação está selecionada; FALSE indica que não está.

Valor de Devolução

A implementação padrão retorna S_OK.

Comentários

Substitua esse método em uma classe derivada para implementar o comportamento personalizado.

CTaskDialog::RemoveAllCommandControls

Remove todos os controles de botão de comando da CTaskDialog.

void RemoveAllCommandControls();

Exemplo

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

Remove todos os botões de opção da CTaskDialog.

void RemoveAllRadioButtons();

Exemplo

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

Atualiza um controle de botão de comando na CTaskDialog.

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

Parâmetros

nCommandControlID
[in] A ID do controle de comando a ser atualizado.

bEnabled
[in] Um parâmetro booliano que indica se o controle de botão de comando especificado está habilitado ou desabilitado.

bRequiresElevation
[in] Um parâmetro booliano que indica se o controle de botão de comando especificado requer elevação.

Comentários

Use esse método para alterar se um controle de botão de comando está habilitado ou requer elevação depois de ter sido adicionado à classe CTaskDialog.

Exemplo

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

Atualiza um subconjunto de botões comuns para a serem habilitados e exigirem elevação de UAC.

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

Parâmetros

nDisabledButtonMask
[in] Uma máscara para os botões comuns a serem desabilitados.

nElevationButtonMask
[in] Uma máscara para os botões comuns que requerem elevação.

Comentários

Você pode definir os botões comuns disponíveis para uma instância da Classe CTaskDialog usando o construtor CTaskDialog::CTaskDialog e o método CTaskDialog::SetCommonButtons. CTaskDialog::SetCommonButtonOptions não dá suporte à adição de novos botões comuns.

Se você usar esse método para desabilitar ou elevar um botão comum que não esteja disponível para essa CTaskDialog, esse método gerará uma exceção usando a macro ENSURE .

Esse método habilita qualquer botão disponível para a CTaskDialog, mas não no nDisabledButtonMask, mesmo que ele tenha sido desabilitado anteriormente. Esse método trata a elevação de maneira semelhante: ele registra botões comuns como não exigindo elevação se o botão comum estiver disponível, mas não incluído no nElevationButtonMask.

Exemplo

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

Adiciona botões comuns à CTaskDialog.

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

Parâmetros

nButtonMask
[in] Uma máscara dos botões a serem adicionados à CTaskDialog.

nDisabledButtonMask
[in] Uma máscara dos botões a serem desabilitados.

nElevationButtonMask
[in] Uma máscara dos botões que requerem elevação.

Comentários

Não é possível chamar esse método depois que a janela de exibição dessa instância da classe CTaskDialog for criada. Se você fizer isso, o método gerará uma exceção.

Os botões indicados por nButtonMask substituem todos os botões comuns adicionados anteriormente à CTaskDialog. Somente os botões indicados em nButtonMask estão disponíveis.

Se nDisabledButtonMask ou nElevationButtonMask contiver um botão que não esteja em nButtonMask, esse método gerará uma exceção usando a macro ENSURE.

Por padrão, todos os botões comuns são habilitados e não requerem elevação.

Exemplo

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

Atualiza o conteúdo da CTaskDialog.

void SetContent(const CString& strContent);

Parâmetros

strContent
[in] A cadeia de caracteres a ser exibida para o usuário.

Comentários

O conteúdo da classe CTaskDialog é o texto exibido para o usuário na seção principal da caixa de diálogo.

Exemplo

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

Especifica o controle de botão de comando padrão.

void SetDefaultCommandControl(int nCommandControlID);

Parâmetros

nCommandControlID
[in] A ID do controle de botão de comando a ser o padrão.

Comentários

O controle de botão de comando padrão é o controle selecionado quando a CTaskDialog é exibida pela primeira vez para o usuário.

Esse método gerará uma exceção se ele não conseguir localizar o controle de botão de comando especificado por nCommandControlID.

Exemplo

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

Especifica o botão de opção padrão.

void SetDefaultRadioButton(int nRadioButtonID);

Parâmetros

nRadioButtonID
[in] A ID do botão de opção a ser o padrão.

Comentários

O botão de opção padrão é o botão selecionado quando a CTaskDialog é exibida pela primeira vez para o usuário.

Esse método gerará uma exceção se não conseguir localizar o botão de opção especificado por nRadioButtonID.

Exemplo

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

Ajusta a largura da CTaskDialog.

void SetDialogWidth(int nWidth = 0);

Parâmetros

nWidth
[in] A largura da caixa de diálogo, em pixels.

Comentários

O parâmetro nWidth deve ser maior ou igual a 0. Caso contrário, esse método gerará uma exceção.

Se nWidth estiver definido como 0, esse método definirá a caixa de diálogo com o tamanho padrão.

Exemplo

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

Atualiza a área de expansão da CTaskDialog.

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

Parâmetros

strExpandedInformation
[in] A cadeia de caracteres que CTaskDialog exibe no corpo principal da caixa de diálogo quando o usuário clica no botão de expansão.

strCollapsedLabel
[in] A cadeia de caracteres que CTaskDialog exibe ao lado do botão de expansão quando a área expandida é recolhida.

strExpandedLabel
[in] A cadeia de caracteres que CTaskDialog exibe ao lado do botão de expansão quando a área expandida é exibida.

Comentários

A área de expansão da classe CTaskDialog permite a você fornecer informações adicionais ao usuário. A área de expansão está na parte principal da CTaskDialog, localizada imediatamente abaixo da cadeia de caracteres de título e conteúdo.

Quando a CTaskDialog é exibida pela primeira vez, ele não mostra as informações expandidas e coloca strCollapsedLabel ao lado do botão de expansão. Quando o usuário clica no botão de expansão, a CTaskDialog exibe strExpandedInformation e altera o rótulo para strExpandedLabel.

Exemplo

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

Atualiza o ícone de rodapé da CTaskDialog.

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

Parâmetros

hFooterIcon
[in] O novo ícone para a CTaskDialog.

lpszFooterIcon
[in] O novo ícone para a CTaskDialog.

Comentários

O ícone de rodapé é exibido na parte inferior da Classe CTaskDialog. Ele pode ter texto de rodapé associado. Você pode alterar o texto do rodapé com CTaskDialog::SetFooterText.

Esse método gerará uma exceção com a macro ENSURE se a opção CTaskDialog for exibida ou o parâmetro de entrada for NULL.

Uma CTaskDialog só pode aceitar um HICON ou LPCWSTR como ícone de rodapé. Isso é configurado definindo a opção TDF_USE_HICON_FOOTER no construtor ou CTaskDialog::SetOptions. Por padrão, a CTaskDialog é configurada para usar LPCWSTR como o tipo de entrada para o ícone de rodapé. Esse método gerará uma exceção se você tentar definir o ícone usando o tipo inadequado.

Exemplo

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

Atualiza o texto no rodapé da CTaskDialog.

void SetFooterText(const CString& strFooterText);

Parâmetros

strFooterText
[in] O novo texto para o rodapé.

Comentários

O ícone de rodapé aparece ao lado do texto do rodapé na parte inferior da CTaskDialog. Você pode alterar o ícone de rodapé com CTaskDialog::SetFooterIcon.

Exemplo

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

Atualiza o ícone principal da CTaskDialog.

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

Parâmetros

hMainIcon
[in] O novo ícone.

lpszMainIcon
[in] O novo ícone.

Comentários

Esse método gerará uma exceção com a macro ENSURE se a opção CTaskDialog for exibida ou o parâmetro de entrada for NULL.

Uma CTaskDialog só pode aceitar um HICON ou LPCWSTR como ícone principal. Você pode configurar isso definindo a opção TDF_USE_HICON_MAIN no construtor ou no método CTaskDialog::SetOptions. Por padrão, a CTaskDialog é configurada para usar LPCWSTR como o tipo de entrada para o ícone principal. Esse método gerará uma exceção se você tentar definir o ícone usando o tipo inadequado.

Exemplo

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

Atualiza a instrução principal da CTaskDialog.

void SetMainInstruction(const CString& strInstructions);

Parâmetros

strInstructions
[in] A nova instrução principal.

Comentários

A instrução principal da classe CTaskDialog é o texto exibido para o usuário em uma fonte grande em negrito. Ela está localizada na caixa de diálogo abaixo da barra de título.

Exemplo

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

Configura as opções para a CTaskDialog.

void SetOptions(int nOptionFlag);

Parâmetros

nOptionFlag
[in] O conjunto de sinalizadores a serem usados para a CTaskDialog.

Comentários

Esse método limpa todas as opções atuais para o CTaskDialog. Para preservar as opções atuais, você primeiro deve recuperá-las com CTaskDialog::GetOptions e combiná-las com as opções que deseja definir.

A tabela a seguir lista todas a opções válidas.

Nome Descrição
TDF_ENABLE_HYPERLINKS Habilita hiperlinks na CTaskDialog.
TDF_USE_HICON_MAIN Configura a CTaskDialog para usar um HICON para o ícone principal. A alternativa é usar um LPCWSTR.
TDF_USE_HICON_FOOTER Configura a CTaskDialog para usar um HICON para o ícone de rodapé. A alternativa é usar um LPCWSTR.
TDF_ALLOW_DIALOG_CANCELLATION Permite que o usuário feche a CTaskDialog usando o teclado ou usando o ícone no canto superior direito da caixa de diálogo, mesmo se o botão Cancelar não estiver habilitado. Se esse sinalizador não estiver definido e o botão Cancelar não estiver habilitado, o usuário não poderá fechar a caixa de diálogo usando Alt+F4, a tecla Escape ou o botão de fechar da barra de título.
TDF_USE_COMMAND_LINKS Configura a CTaskDialog para usar controles de botão de comando.
TDF_USE_COMMAND_LINKS_NO_ICON Configura a CTaskDialog para usar controles de botão de comando sem exibir um ícone ao lado do controle. TDF_USE_COMMAND_LINKS substitui TDF_USE_COMMAND_LINKS_NO_ICON.
TDF_EXPAND_FOOTER_AREA Indica que a área de expansão está expandida no momento.
TDF_EXPANDED_BY_DEFAULT Determina se a área de expansão é expandida por padrão.
TDF_VERIFICATION_FLAG_CHECKED Indica que a caixa de seleção de verificação está selecionada no momento.
TDF_SHOW_PROGRESS_BAR Configura a CTaskDialog para exibir uma barra de progresso.
TDF_SHOW_MARQUEE_PROGRESS_BAR Configura a barra de progresso para ser uma barra de progresso de letreiro. Se habilitar essa opção, você deverá definir TDF_SHOW_PROGRESS_BAR para ter o comportamento esperado.
TDF_CALLBACK_TIMER Indica que o intervalo de retorno de chamada CTaskDialog está definido como aproximadamente 200 milissegundos.
TDF_POSITION_RELATIVE_TO_WINDOW Configura a CTaskDialog para ser centralizada em relação à janela pai. Se esse sinalizador não estiver habilitado, a CTaskDialog será centralizada em relação ao monitor.
TDF_RTL_LAYOUT Configura a CTaskDialog para um layout de leitura da direita para a esquerda.
TDF_NO_DEFAULT_RADIO_BUTTON Indica que nenhum botão de opção está selecionado quando a CTaskDialog aparece.
TDF_CAN_BE_MINIMIZED Permite que o usuário minimize a CTaskDialog. Para dar suporte a essa opção, a CTaskDialog não pode ser modal. O MFC não dá suporte a essa opção porque o MFC não dá suporte a uma CTaskDialog sem janela restrita.

Exemplo

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

Configura uma barra de letreiro para a CTaskDialog e a adiciona à caixa de diálogo.

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

Parâmetros

bEnabled
[in] TRUE para habilitar a barra de letreiro; FALSE para desabilitar a barra de letreiro e removê-la da CTaskDialog.

nMarqueeSpeed
[in] Um inteiro que indica a velocidade da barra de letreiro.

Comentários

A barra de letreiro aparece sob o texto principal da classe CTaskDialog.

Use nMarqueeSpeed para definir a velocidade da barra de letreiro. Valores maiores indicam uma velocidade mais lenta. Um valor 0 para nMarqueeSpeed faz com que a barra de letreiro se mova na velocidade padrão do Windows.

Esse método gera uma exceção com a macro ENSURE se nMarqueeSpeed for menor que 0.

Exemplo

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

Ajusta a posição da barra de progresso.

void SetProgressBarPosition(int nProgressPos);

Parâmetros

nProgressPos
[in] A posição da barra de progresso.

Comentários

Esse método gera uma exceção com a macro ENSURE se nProgressPos não estiver no intervalo de barras de progresso. Você pode alterar o intervalo de barras de progresso com CTaskDialog::SetProgressBarRange.

Exemplo

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

Ajusta o intervalo da barra de progresso.

void SetProgressBarRange(
    int nRangeMin,
    int nRangeMax);

Parâmetros

nRangeMin
[in] O limite inferior da barra de progresso.

nRangeMax
[in] O limite superior da barra de progresso.

Comentários

A posição da barra de progresso é relativa a nRangeMin e nRangeMax. Por exemplo, se nRangeMin for 50 e nRangeMax for 100, uma posição de 75 estará na metade da barra de progresso. Use CTaskDialog::SetProgressBarPosition para definir a posição da barra de progresso.

Para exibir a barra de progresso, a opção TDF_SHOW_PROGRESS_BAR deve ser habilitada e TDF_SHOW_MARQUEE_PROGRESS_BAR não deve ser habilitada. Esse método define automaticamente TDF_SHOW_PROGRESS_BAR e limpa TDF_SHOW_MARQUEE_PROGRESS_BAR. Use CTaskDialog::SetOptions para alterar manualmente as opções para esta instância da Classe CTaskDialog.

Esse método gerará uma exceção com a macro ENSURE se nRangeMin não for menor que nRangeMax. Esse método também gerará uma exceção se a CTaskDialog já estiver exibida e tiver uma barra de progresso de letreiro.

Exemplo

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

Define o estado da barra de progresso e exibe-o na CTaskDialog.

void SetProgressBarState(int nState = PBST_NORMAL);

Parâmetros

nState
[in] O estado da barra de progresso. Confira a seção Comentários para ver os valores possíveis.

Comentários

Esse método também gerará uma exceção com a macro ENSURE se a CTaskDialog já estiver exibida e tiver uma barra de progresso de letreiro.

A tabela a seguir lista os valores possíveis para nState. Em todos esses casos, a barra de progresso será preenchida com a cor regular até alcançar a posição de parada designada. Nesse ponto, ela mudará de cor com base no estado.

Nome Descrição
PBST_NORMAL Após o preenchimento da barra de progresso, a CTaskDialog não altera a cor da barra. Por padrão, a cor regular é verde.
PBST_ERROR Após o preenchimento da barra de progresso, a CTaskDialog altera a cor da barra para a cor do erro. Por padrão, essa cor é vermelho.
PBST_PAUSED Após o preenchimento da barra de progresso, a CTaskDialog altera a cor da barra para a cor de pausa. Por padrão, essa cor é amarelo.

Você pode definir onde a barra de progresso é interrompida com CTaskDialog::SetProgressBarPosition.

Exemplo

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

Habilita ou desabilita um botão de opção.

void SetRadioButtonOptions(
    int nRadioButtonID,
    BOOL bEnabled);

Parâmetros

nRadioButtonID
[in] A ID do controle de botão de opção.

bEnabled
[in] TRUE para habilitar o botão de opção; FALSE para desabilitá-lo.

Comentários

Esse método gerará uma exceção com a macro ENSURE se nRadioButtonID não for uma ID válida para um botão de opção.

Exemplo

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

Define o estado marcado da caixa de seleção de verificação.

void SetVerificationCheckbox(BOOL bChecked);

Parâmetros

bChecked
[in] TRUE para ter a caixa de seleção de verificação selecionada quando a CTaskDialog for exibida; FALSE para que a caixa de seleção de verificação não seja selecionada quando a CTaskDialog for exibida.

Exemplo

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

Define o texto exibido à direita da caixa de seleção de verificação.

void SetVerificationCheckboxText(CString& strVerificationText);

Parâmetros

strVerificationText
[in] O texto que este método exibe ao lado da caixa de seleção de verificação.

Comentários

Esse método gerará uma exceção com a macro ENSURE se essa instância da classe CTaskDialog já estiver exibida.

Exemplo

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

Define o título do CTaskDialog.

void SetWindowTitle(CString& strWindowTitle);

Parâmetros

strWindowTitle
[in] O novo título para a CTaskDialog.

Comentários

Exemplo

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

Cria e exibe um 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(""));

Parâmetros

strContent
[in] A cadeia de caracteres a ser usada para o conteúdo da CTaskDialog.

strMainInstruction
[in] A instrução principal da CTaskDialog.

strTitle
[in] O título da CTaskDialog.

nIDCommandControlsFirst
[in] A ID da cadeia de caracteres do primeiro comando.

nIDCommandControlsLast
[in] A ID da cadeia de caracteres do último comando.

nCommonButtons
[in] Uma máscara dos botões a serem adicionados à CTaskDialog.

nTaskDialogOptions
[in] O conjunto de opções a ser usado para a CTaskDialog.

strFooter
[in] A cadeia de caracteres a ser usada como rodapé.

Valor de Devolução

Um inteiro que corresponde à seleção feita pelo usuário.

Comentários

Esse método estático permite que você crie uma instância da classe CTaskDialog sem criar explicitamente um objeto CTaskDialog no código. Como não há nenhum objeto CTaskDialog, não é possível chamar outros métodos da CTaskDialog se você usar esse método para mostrar uma CTaskDialog ao usuário.

Esse método cria controles de botão de comando usando dados do arquivo de recurso do aplicativo. A tabela de cadeia de caracteres no arquivo de recurso tem várias cadeias de caracteres com IDs de cadeia de caracteres associadas. Esse método adiciona um controle de botão de comando para cada entrada válida na tabela de cadeia de caracteres entre nIDCommandControlsFirst e nCommandControlsLast, inclusive. Para esses controles de botão de comando, a cadeia de caracteres na tabela de cadeia de caracteres é a legenda do controle e a ID da cadeia de caracteres é a ID do controle.

Confira CTaskDialog::SetOptions para ver uma lista de opções válidas.

A CTaskDialog fecha quando o usuário seleciona um botão comum, um controle de link de comando ou fecha a CTaskDialog. O valor retornado é o identificador que indica como o usuário fechou a caixa de diálogo.

Exemplo

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

A estrutura chama esse método em resposta a várias mensagens do Windows.

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

Parâmetros

hwnd
[in] Um identificador para a estrutura m_hWnd para a CTaskDialog.

uNotification
[in] O código de notificação que especifica a mensagem gerada.

wParam
[in] Mais informações sobre a mensagem.

lParam
[in] Mais informações sobre a mensagem.

dwRefData
[in] Um ponteiro para o objeto CTaskDialog ao qual a mensagem de retorno de chamada se aplica.

Valor de Devolução

Depende do código de notificação específico. Consulte a seção Comentários para obter mais informações.

Comentários

A implementação padrão de TaskDialogCallback manipula a mensagem específica e chama o método On apropriado da Classe CTaskDialog. Por exemplo, em resposta à mensagem TDN_BUTTON_CLICKED, TaskDialogCallback chama CTaskDialog::OnCommandControlClick.

Os valores para wParam e lParam dependem da mensagem específica gerada. É possível que um ou ambos os valores estejam vazios. A tabela a seguir lista as notificações padrão com suporte e o que os valores de wParam e lParam representam. Se você substituir esse método em uma classe derivada, será necessário implementar o código de retorno de chamada para cada mensagem na tabela a seguir.

Mensagem de notificação Valor wParam Valor lParam
TDN_CREATED Não usado. Não usado.
TDN_NAVIGATED Não usado. Não usado.
TDN_BUTTON_CLICKED A ID do controle de botão de comando. Não usado.
TDN_HYPERLINK_CLICKED Não usado. Uma estrutura LPCWSTR que contém o link.
TDN_TIMER Tempo em milissegundos desde que a CTaskDialog foi criada ou o temporizador foi redefinido. Não usado.
TDN_DESTROYED Não usado. Não usado.
TDN_RADIO_BUTTON_CLICKED A ID do botão de opção. Não usado.
TDN_DIALOG_CONSTRUCTED Não usado. Não usado.
TDN_VERIFICATION_CLICKED 1 se a caixa de seleção estiver marcada, 0 se estiver desmarcada. Não usado.
TDN_HELP Não usado. Não usado.
TDN_EXPANDO_BUTTON_CLICKED 0 se a área de expansão estiver recolhida; diferentes de zero se o texto de expansão for exibido. Não usado.

Confira também

Classes
Classe CObject
Gráfico da hierarquia
Instruções passo a passo: adicionando um CTaskDialog a um aplicativo