积极答复者
ITextRange2::SetURL 接口不好用

问题
答案
-
终于解决了:https://blogs.msdn.microsoft.com/murrays/2009/09/24/richedit-friendly-name-hyperlinks/
The text in the bstr needs to start and end with ASCII double quotes. The word HYPERLINK is inserted in front of the URL by the SetURL() method.
虽然SetUrl成功了,但ITextRange2::GetPoint又有问题了
- 已标记为答案 贾延辉 2016年6月30日 9:52
全部回复
-
Hi 贾廷辉,
感谢在MSDN论坛发帖。
首先和你确认一下,你是想使用ITextRange2::SetURL 还是 ITextRange2::GetURL ?
如果是ITextRange2::GetURL函数,ITextRange2::GetURL 方法的参数是BSTR *pbstr类型的返回值,不需要赋值。
如果是ITextRange2::SetURL函数,CComBSTR 构造函数建议以下使用方法。
CComPtr<ITextRange2> range = m_input->GetRange(0,1); CComBSTR bstr(L"http://www.163.com"); HRESULT hr = range->SetURL(bstr);
Best Regards,
Sera Yu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
-
终于解决了:https://blogs.msdn.microsoft.com/murrays/2009/09/24/richedit-friendly-name-hyperlinks/
The text in the bstr needs to start and end with ASCII double quotes. The word HYPERLINK is inserted in front of the URL by the SetURL() method.
虽然SetUrl成功了,但ITextRange2::GetPoint又有问题了
- 已标记为答案 贾延辉 2016年6月30日 9:52