我是为了在我的浏览器中(基于CHtmlview),做一个简单收藏夹的功能,就是把当前的网址和网页的名称,写入到ini文件中。比如,我在maxthon中,把网页:“http://topic.csdn.net/t/20031212/13/2556726.html”加入收藏夹时,在网页名称中将显示:“---200分,如何取得链接所属的网页url和该链接名称----- VC-MFC - 基础类 - CSDN社区 community.csdn.net”。我现在就是想获得网页名称“200分,如何取得链接所属的网页url和该链接名称----- VC-MFC - 基础类 - CSDN社区 community.csdn.net”,请告诉我具体的获得方法。我知道strURL是当前网址,但是这个网站简介,不知道什么怎么获得了。
m_pBrowserApp->get_LocationURL(&bstrUrl);
然后IHTMLDocument2::get_title(BSTR *p);
附:
IHTMLDocument2::title PropertySets or gets the title of the document.Syntax HRESULT IHTMLDocument2::get_title(BSTR *p);
HRESULT IHTMLDocument2::put_title(BSTR v);Parameters p
Pointer to a variable of type BSTR that receives the title.
v
BSTR that specifies the title.Return Value Returns S_OK if successful, or an error value otherwise.Res The title identifies the contents of the document and is displayed in the header bar of the document window. This function sets or gets the TITLE object in the document header (defined by the HEAD object).
D:\webbrowser正确版\webbrowserView.cpp(187) : error C2065: 'pHtmlDoc2' : undeclared identifier
D:\webbrowser正确版\webbrowserView.cpp(187) : error C2059: syntax error : ')'
Generating Code...
要插入什么头文件??
#include <afxdhtml.h>
根据CHtmlview得到所加载网页的IHTMLDocument2才能得到标题。
还有,我用的是VC 6,网上说,都要自己写读title的函数的,你给我的函数,好像能直接获得title,但是msdn里面查不到,这怎么回事啊?
2、http://msdn2.microsoft.com/en-au/library/aa752635(VS.85).aspx