I derive a class from CTaskDialog to implement an AutoCloseButton.
HRESULT CMyTaskDialog::OnTimer(_In_ long lTime)
{
if (GetTickCount() - m_dwStart > (DWORD)m_nTimeout)
{
SendMessage(m_hWnd, TDM_CLICK_BUTTON, IDOK, 0);
}
return CTaskDialog::OnTimer(lTime);
}
Unfortunately m_hWnd is a private member in CTaskDialog, so I have no accces to it.
The CTaskDialog has the member
friend HRESULT CALLBACK TaskDialogCallback(_In_ HWND hwnd, _In_ UINT uNotification, _In_ WPARAM wParam, _In_ LPARAM lParam, _In_ LONG_PTR dwRefData);
But it is not possible to derive it (LNK2005 error (already defined in afxtaskdialog.obj) or I don't know how to do this.