Archive: TaskDialog in Windows Vista


TaskDialog in Windows Vista
Hi!

Is it at all possible that someone could please show me (with an example) how to implement Windows Vista's TaskDialog API function using the System plugin?

HRESULT TaskDialog(HWND hWndParent,
HINSTANCE hInstance,
PCWSTR pszWindowTitle,
PCWSTR pszMainInstruction,
PCWSTR pszContent,
TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons,
PCWSTR pszIcon,
int *pnButton
);

I have no idea where to start, so any help would be immensely appreciated!

Thanks in advance,
Brad.


Untested.

!define TDCBF_OK_BUTTON 0x1
!define TDCBF_YES_BUTTON 0x2
!define TDCBF_NO_BUTTON 0x4
!define TDCBF_CANCEL_BUTTON 0x8
!define TDCBF_RETRY_BUTTON 0x10
!define TDCBF_CLOSE_BUTTON 0x20

!define TD_WARNING_ICON -1
!define TD_ERROR_ICON -2
!define TD_INFORMATION_ICON -3
!define TD_SHIELD_ICON -4

!define IDOK 1
!define IDCANCEL 2
!define IDABORT 3
!define IDRETRY 4
!define IDIGNORE 5
!define IDYES 6
!define IDNO 7

System::Call "comctl32::TaskDialog(i $HWNDPARENT, i 0, \
w 'title', w 'instruction', w 'content', \
i ${TDCBF_YES_BUTTON}|${TDCBF_NO_BUTTON}, \
i ${TD_INFORMATION_ICON}, *i .r0)"

${If} $0 == ${IDYES}
MessageBox MB_OK yes
${ElseIf} $0 == ${IDNO}
MessageBox MB_OK no
${EndIf}

Thanks for your hep, Kichik! (Sorry it has taken me a while to respond.)

Unfortunately, though, the code causes my installer to crash... :( Any other ideas?

Thanx again,
Brad.


Seems like it hates the icon. Replace ${TD_INFORMATION_ICON} with 0.


That's it, thank you! Any way of getting that icon to work, though?


Don't know, you'll have to dig into MSDN.


And then, after a bit of playing around, we now have:

!define TD_WARNING_ICON 84
!define TD_ERROR_ICON 98
!define TD_INFORMATION_ICON 81
!define TD_SHIELD_ICON 78


This'll now work as expected... :D

Brad.