惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
S
Securelist
The Hacker News
The Hacker News
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
AI
AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
博客园 - 司徒正美
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest
Engineering at Meta
Engineering at Meta
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
U
Unit 42
V
V2EX
V2EX - 技术
V2EX - 技术
L
LINUX DO - 最新话题
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
Recorded Future
Recorded Future
P
Privacy & Cybersecurity Law Blog
美团技术团队
小众软件
小众软件
F
Fortinet All Blogs

博客园 - angushine

获得本机IP地址 设置eclipse文件默认的编码方式 Eclipse Helios的PermGen space错误的解决办法 取指定长度的字符串(双字节算2) - angushine - 博客园 截取指定长度字符串 Silverlight项目无法启动调试 增强 VSS 的文件共享安全性 兼容各个版本浏览器的设置最小宽度 动态分配一维数组 浏览器区别 封装log4net C#获得调用方法的名称和类名 jQuery全选/全消CheckBox以及JS回调一例 MySQL绿色安装方法1 定时更新内存和虚拟内存 多线程中更新组件 Request、Request.QueryString、Request.Form与Request.Params 反射调用静态方法 开始→运行→输入的命令集锦(转载)
WebBrowser中调用加载页面的Javascript方法
angushine · 2009-10-16 · via 博客园 - angushine

using AxSHDocVw;
using Microsoft.VisualBasic;
using mshtml;

AxWebBrowser awb 

= (AxWebBrowser)page.Controls[0];
SHDocVw.IWebBrowser2 iwb 
= (SHDocVw.IWebBrowser2)awb.Application;
object app = awb.Application;
string name = Information.TypeName(app);

HTMLDocumentClass doc 

= (HTMLDocumentClass)awb.Document;
if (doc != null)
{
    HTMLBodyClass body 
= (HTMLBodyClass)doc.getElementsByTagName("body").item(null0);
    HTMLScriptElementClass script 
= (HTMLScriptElementClass)doc.createElement("script");
    script.setAttribute(
"type""text/javascript"0);
    script.text 
= "closeControl();";
    body.appendChild((IHTMLDOMNode)script);
    doc.close();
}
awb.Dispose();
awb 
= null;

tab.TabPages.Remove(page);

page.Dispose();
GC.Collect();

#import "C:\WINDOWS\system32\mshtml.tlb"/* 动态修改网页中的内容
IHTMLDocument2* pHTMLFocument2;
LPDISPATCH lpDispatch;
lpDispatch = m_wb.get_Document();
if(lpDispatch)
{
    HRESULT hr;
    hr = lpDispatch->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pHTMLFocument2);
    lpDispatch->Release();
    IHTMLElement* pBody;
    hr = pHTMLFocument2->get_body(&pBody);
    UpdateData(TRUE);
    BSTR bstr = L"hxh";
    // pBody->get_innerHTML(bstr);
    pBody->put_innerHTML(bstr);  
    SysFreeString(bstr);
    pBody->Release();
*/// 动态执行网页中的方法
MSHTML::IHTMLDocument2Ptr spDoc(m_wb.get_Document());
if (spDoc)
{
    IDispatchPtr spDisp(spDoc
->GetScript());
    
if (spDisp)
    {
        OLECHAR FAR
* szMember = L"closeControl";
        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, FALSE);
            dispDriver.InvokeHelper(dispid, DISPATCH_METHOD, VT_VARIANT, (
void*)&vtResult, parms, "");
        }
    }
}