//获取外部浏览器网页源码 
import win;
import winex; 
import com  
import win.guid


Oleacc := raw.loadDll("OLEACC.DLL");
ObjectFromLresult := Oleacc.api("ObjectFromLresult","int(int lResult,struct riid,int wParam,pointer &ppvObject)" ); 
WM_HTML_GETOBJECT := ::RegisterWindowMessage("WM_HTML_GETOBJECT"); 
function getAccessibleObject(hwnd,iid){
	var re, res = ::SendMessageTimeout (hwnd, WM_HTML_GETOBJECT, 0,0, 0x2/*_SMTO_ABORTIFHUNG*/,1000,0)  
	var re,unknown = ::ObjectFromLresult(res, iid , 0 );
	//将一个 C指针转换为com对象
	return com.QueryObject( unknown )
}

//查找IE窗口
var hwndIE = winex.findEx(,,"Internet Explorer_Server" )
assert(hwndIE,"请先打开IE浏览器，然后再运行本程序!") 

IID_IHTMLDocument = win.guid.fromString("{626FC520-A41E-11CF-A731-00A0C9082637}")
/*
IID_IHTMLDocument = {
	INT Data1 = 0x626FC520 ;
	WORD Data2 = 0xA41E ;
	WORD Data3 =0x11CF ;
	BYTE Data4[ 8 ] = { 0xA7 ;0x31;0x0;0xA0;0xC9;0x8;0x26;0x37 };
} 
*/  
doc  = getAccessibleObject( hwndIE, IID_IHTMLDocument)

io.open()
com.DumpTypeInfo(doc.body)  //显示com对象的所有成员
io.print( doc.body.innerHTML ) //获取网页源代码

execute("pause") //按任意键继续
io.close();//关闭控制台

