Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Controls
Control Library
Task Dialog
Functions
 TaskDialogIndirect Function
TaskDialogIndirect Function

The TaskDialogIndirect function creates, displays, and operates a task dialog. The task dialog contains application-defined icons, messages, title, verification check box, command links, push buttons, and radio buttons. This function can register a callback function to receive notification messages.

Syntax

HRESULT TaskDialogIndirect(      
    const TASKDIALOGCONFIG *pTaskConfig,     int *pnButton,     int *pnRadioButton,     BOOL *pfVerificationFlagChecked );

Parameters

pTaskConfig
[in] Pointer to a TASKDIALOGCONFIG structure that contains information used to display the task dialog.
pnButton
[out] 

Address of a variable that receives either:

  • one of the button IDs specified in the pButtons member of the pTaskConfig parameter
  • one of the following values:
ValueDescription
0Function call failed. Refer to return value for more information.
IDCANCELCancel button was selected, Alt-F4 was pressed, Escape was pressed or the user clicked on the close window button.
IDNONo button was selected.
IDOKOK button was selected.
IDRETRYRetry button was selected.
IDYESYes button was selected.

If this parameter is NULL, no value is returned.

pnRadioButton
[out] Address of a variable that receives one of the button IDs specified in the pRadioButtons member of the pTaskConfig parameter. If this parameter is NULL, no value is returned.
pfVerificationFlagChecked
[out] 

Address of a variable that receives one of the following values:

ValueDescription
TRUEThe verification checkbox was checked when the dialog was dismissed.
FALSEThe verification checkbox was not checked when the dialog was dismissed.

If this parameter is NULL, the verification checkbox is disabled.

Return Value

Returns one of the following values.

S_OKThe operation completed successfully.
E_OUTOFMEMORYThere is insufficient memory to complete the operation.
E_INVALIDARGOne or more arguments are invalid.
E_FAILThe operation failed.

Remarks

When you use a task dialog box to indicate that the system is low on memory, the strings pointed to by the various string and icon members in the TASKDIALOGCONFIG structure should not be taken from a resource file since an attempt to load the resource may fail.

If you create a task dialog while a dialog box is present, use a handle to the dialog box as the hWndParent parameter. The hWndParent parameter should not identify a child window, such as a control in a dialog box.

The parent window should not be hidden or disabled when this function is called.


int nButtonPressed                  = 0;
TASKDIALOGCONFIG config             = {0};
const TASKDIALOG_BUTTON buttons[]   = { 
                                        { IDOK, L"Change password" }
                                      };
config.cbSize                       = sizeof(config);
config.hInstance                    = hInst;
config.dwCommonButtons              = TDCBF_CANCEL_BUTTON;
config.pszMainIcon                  = TD_WARNING_ICON;
config.pszMainInstruction           = L"Change Password";
config.pszContent                   = L"Remember your changed password.";
config.pButtons                     = buttons;
config.cButtons                     = ARRAYSIZE(buttons);

TaskDialogIndirect(&config, &nButtonPressed, NULL, NULL);
switch (nButtonPressed)
{
    case IDOK:
        break; // the user pressed button 0 (change password).
    case IDCANCEL:
        break; // user cancelled the dialog
    default:
        break; // should never happen
}

Function Information

Minimum DLL Versioncomctl32.dll version 6
HeaderDeclared in commctrl.h, include commctrl.h
Import librarycomctl32.lib
Minimum operating systems Windows Vista

See Also

Dialog Boxes, TaskDialog
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker