从编程中获取Internet Explorer 8的当前URL
Getting current URL of Internet Explorer 8 programatically
我正在开发一个简单的Internet Explorer附加组件,我正在尝试使用一系列(示例(HWND handle = FindWindowEx(parent_handle,0,"AddressDisplay Control",NULL);
按以下顺序:
1- IEFrame
2- WorkerW
3- ReBarWindow32
4- Address Band Root
5- Edit
5- (alternatively) AddressDisplay Control
我已经确定了使用winspy 1.6
确定此系列对照我正在尝试获取当前URL的代码是:
TCHAR currentURL[255];
::GetWindowText(handle_to_the_Edit_or_AddressDisplay_control, currentURL, 255);
但是,它没有设置在Currenturl数组中。
这种方法,具有稍微更改的名称和一系列控件,用于较早版本ıfie,我可以easliy获取当前的URL,但是对于IE 8,我无法获得它。
我该怎么办?谢谢
注意:我已经搜索了许多页面和帖子。没有运气。
应用@Remy Lebeau的建议char *p = _com_util::ConvertBSTRToString(bstrURL);
,::SendMessage(hMyEditControl,WM_SETTEXT,0,(long)p);
开始正确显示。
这说明了为什么从UI控件中获取URL的IE 7方法在IE 8:
上不起作用。Because that is not the right way to do it, even in IE7.
Just because it could be done that way does not mean it should be done that way.
There is a reason why a BHO has direct access to the underlying WebBrowser object,
the BHO should not rely on any particular UI representation of the WebBrowser object.
这就是接受的答案。
相关文章:
- 如何使用url确定网站协议
- 下载URL中的所有文件
- 使用libcurl提交批量url的正确BING Api POST url是什么
- 将所有 URL 组织在类中的一个位置
- 从 C++ 中的 URL 获取结果
- 在加载 MSHTML 文档之前从 MSHTML 文档中删除无效的 URL
- 连接到 URL Sqlite 数据库C++
- 如何在QTextEdit中添加URL或IMAGE-URL
- c++ 网络浏览器块 url
- PHP Profiler语言 - 使用 C++ 从 PHP 扩展获取客户端 IP 和 URL
- 如何在C++中获取重定向网页的URL
- #include of a HTTP URL in C++
- C++ libcurl - 无法从 URL 检索整个 html 内容
- Bazel:http_archive()中url的相对本地路径
- Winsock 数据不是从 IP 检索的,而是从普通 URL 检索的
- 如何使用libcurl c ++从url保存XML文件
- 哪些字符会自动C++ Windows HttpOpenRequest() 进行 url 转义?
- 将 URL/href 从网络服务器重新派生到ESP8266(以处理它)
- 从编程中获取Internet Explorer 8的当前URL
- 在新选项卡(Internet Explorer)中打开URL