使用JavaScript的C ++ MFC WebBrowser控件? [英] C++ MFC WebBrowser Control with JavaScript?
本文介绍了使用JavaScript的C ++ MFC WebBrowser控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找有关在MFC中创建WebBrowser控件的代码或项目或教程的示例,这些代码或示例可允许我嵌入Google地图设置标记,然后将这些标记用作超链接,如果有帮助的话,任何人都知道这样的程序,请评论谢谢:)
I''m looking to find some code or samples of projects or tutorials on creating a WebBrowser Control in MFC that would allow me to embed Google maps set markers and then use those markers as hyperlinks, any Help would be great, if anyone knows of a program that is already like this please comment thank you :)
推荐答案
您可以例如:
1)创建一个基于对话框的项目.
2)允许ocx控件.
3)打开对话框资源.
4)右键单击并选择插入ocx对象.
5)选择 Microsoft Web浏览器.
6)右键单击ocx,然后选择添加新成员.
7)仅键入成员名称(即m_web
.
You can for example:
1) create a dialog based project.
2) allow ocx controls.
3) open the dialog resource.
4) right click and select insert ocx-object.
5) select Microsoft Web Browser.
6) right click on the ocx and select add a new member.
7) only type at member name (i.e.)m_web
.
BOOL CGMapsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
m_web.Navigate2(&_variant_t(L"http://maps.google.com/"),0,0,0,0);
IDispatch* doc = m_web.get_Document();
if(doc)
{
// from here you have full access to the complete document structure
doc->Release();
}
return TRUE;
}
要使用_variant_t
,您需要:
for usage of _variant_t
you need:
#include <comutil.h>
#pragma comment (lib,"comsuppw.lib")
问候.
这篇关于使用JavaScript的C ++ MFC WebBrowser控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文