c中 知道IE的句柄怎么取地址栏的内容呀?求代码!!!

eastrise_liu 2010-10-28 08:13:23
c中 知道IE的句柄怎么取地址栏的内容呀?求代码!!!理论我也知道,就是不回实现..新手!
我想实现的是用MFC做个小程序,当本地的IE地址栏内容改变时,弹个MESBOX出来..
...全文
76 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
eastrise_liu 2010-10-29
  • 打赏
  • 举报
回复
更正一下:是VC下,MFC
InitInstance1 2010-10-29
  • 打赏
  • 举报
回复
The following Visual C++ source code demonstrates how to implement this in your own application. This code uses smart pointers created by the #import statement. You must include this #import statement in one of your source code files, preferably Stdafx.h:


#import "C:\winnt\system32\mshtml.tlb " // location of mshtml.tlb

void CMyClass::ExecuteScriptFunction()
{
// m_WebBrowser is an instance of IWebBrowser2
MSHTML::IHTMLDocument2Ptr spDoc(m_WebBrowser.GetDocument());

if (spDoc)
{
IDispatchPtr spDisp(spDoc-> GetScript());
if (spDisp)
{
// Evaluate is the name of the script function.
OLECHAR FAR* szMember = L "evaluate ";
DISPID dispid;

HRESULT hr = spDisp-> GetIDsOfNames(IID_NULL, &szMember, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);

if (SUCCEEDED(hr))
{
COleVariant vtResult;
static BYTE parms[] = VTS_BSTR;

COleDispatchDriver dispDriver(spDisp);

dispDriver.InvokeHelper(dispid, DISPATCH_METHOD, VT_VARIANT,
(void*)&vtResult, parms,
"5+Math.sin(9) ");
}
}
}
}
eastrise_liu 2010-10-29
  • 打赏
  • 举报
回复
自己顶下

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧