CTaskDialog 页脚中的超链接

Hyperlinks in CTaskDialog footer

我已阅读这篇文章:

Article

它清楚地表明页脚中支持超链接。我不知道该怎么做。我不想要文本中的文字 URL,而是其他文本超链接到程序中的帮助文章。

这个有效:

#include "stdafx.h"
#include "CMyTaskDialog.h"

IMPLEMENT_DYNAMIC(CMyTaskDialog, CTaskDialog)


CMyTaskDialog::CMyTaskDialog(_In_ const CString& strContent, 
                             _In_ const CString& strMainInstruction, 
                             _In_ const CString& strTitle,
                             _In_ int nCommonButtons,
                             _In_ int nTaskDialogOptions, _In_ const CString& strFooter)
    : CTaskDialog(strContent, strMainInstruction, strTitle, nCommonButtons, nTaskDialogOptions, strFooter)
{
}


CMyTaskDialog::~CMyTaskDialog()
{
}




HRESULT CMyTaskDialog::OnHyperlinkClick(const CString& strHref)
{
    HWND hwnd =
        HtmlHelp(
            GetDesktopWindow(),
            _T("d:\MeetSchedAssist.chm::/") + strHref,
            HH_DISPLAY_TOPIC,
            NULL);

    return S_OK;
}

但是,还有两个问题:

  1. CTaskDialog 没有 GetSafeHWnd API 调用所以我不知道如何将其设置为父级。

  2. OnHyperlinkClick 是通用的,因此如果您在任务对话框中有多个链接,您可能必须测试该短语才能决定如何处理它。