获取其它进程中的Web Browser中的HTML源码
HWND H1,H2,H3,H4,hw;
H1=H2=H3=H4=hw=NULL;
H1=::FindWindow("TForm1",NULL);
if (H1) H2=::FindWindowEx(H1,NULL,"Shell Embedding",NULL);
if (H2) H3=::FindWindowEx(H2,NULL,"Shell DocObject View",NULL);
if (H3) H4=::FindWindowEx(H3,NULL,"Internet Explorer_Server",NULL);
if (H4) hw=H4;
else
{
AfxMessageBox("No Found the Dialog with IE!");
return;
}
IHTMLDocument2 *pHTMLDocument=NULL;
DWORD lRes;
HRESULT hres;
UINT MSG = RegisterWindowMessage("WM_HTML_GETOBJECT");
SendMessageTimeout(hw, MSG, 0, 0, SMTO_ABORTIFHUNG, 1000, &lRes);
hres=ObjectfromLresult(lRes,__uuidof(IHTMLDocument2),0,(void**)&pHTMLDocument);
if(hres==S_OK)
{
IPersistStreamInit *pPSI=NULL;
IStream *pStream=NULL;
HGLOBAL hHTMLText;
if (FAILED(pHTMLDocument->QueryInterface(&pPSI))) return;
hHTMLText = GlobalAlloc(GMEM_FIXED, 65534);
CreateStreamOnHGlobal(hHTMLText, TRUE, &pStream);
pPSI->Save(pStream, FALSE);
char *pText = (char*)hHTMLText;
FILE *f=fopen("data_from_explorer.txt","w");
fwrite(pText,1,strlen(pText),f);
fclose(f);
AfxMessageBox("the source codes Saved in data_from_explorer.txt");
pStream->Release();
pPSI->Release();
}
相关文档:
学无止境!!!
今天在论坛回答帖子,学到了一招,select原来可以使用optgroup 标签,对option进行分类!
特意从网上摘录了下面的文章...
在 html里,optgroup这个元素对于我来说很少用到。最近在公司做项目时使用了一下,感觉不错,可以对数据进行分类。但在使用JavaScript 添加optgroup时,在IE与Fire ......
using System.Text.RegularExpressions; //引入的命名空间
以下为引用的内容:
//清除HTML函数
public static string NoHTML(string Htmlstring)
{
//删除脚本
Htmlstr ......
第一种:
<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
alert("返回");
window.history.back ......
flex嵌入到html:
用swfobject,下载的.js地址:http://www.adobe.com/devnet/activecontent/articles/devletter.html
在你的 HTML 页面头部<head>区嵌入这个脚本文件:<script type="text/javascript" src="swfobject.js"></script>
在你的 HTML 中写一个用来放 Flash 的容器,比如<div> ......
到底元素的id和name有什么区别阿?为什么有了id还要有name呢?!
id的主要用途:
在客户端页面作为对象的唯一表示,同一个页面中不允许出现多个相同的id.可以使用javascript的document.getElementById('id')来获取对象.
name的具体用途有:
用途1:
作为可与服务器交互数据的HTML元素的服务器端的标示,比如input、sele ......