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

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MyScale Blog
MyScale Blog
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园_首页
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
L
LINUX DO - 热门话题
Project Zero
Project Zero
罗磊的独立博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MongoDB | Blog
MongoDB | Blog
Spread Privacy
Spread Privacy
S
Schneier on Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
J
Java Code Geeks
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - Franky
T
Threat Research - Cisco Blogs
D
Docker
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
Google DeepMind News
Google DeepMind News
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
月光博客
月光博客
V
Vulnerabilities – Threatpost
NISL@THU
NISL@THU
V
Visual Studio Blog
AWS News Blog
AWS News Blog
I
Intezer
T
The Blog of Author Tim Ferriss
P
Privacy International News Feed
T
Tor Project blog
F
Full Disclosure
P
Proofpoint News Feed
SecWiki News
SecWiki News
H
Heimdal Security Blog
Help Net Security
Help Net Security
The Hacker News
The Hacker News

博客园 - 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, "");
        }
    }
}