HSPからIHTMLDocument(HTMLパーサー)を使ってみるサンプルです。bodyタグ内のHTMLを取得してみます。HTMLの解析だったらIEコンポでもいいのですが、こちらの方がメモリの消費が少なそう&ページ移動時にカチカチ言わないのでこっちの方がいいかなーぐらいな考えでし。IHTMLDocumentではなく、htmlfileでも同じことができるみたい?
HSPからIHTMLDocument(HTMLパーサー)を使ってみるサンプルです。bodyタグ内のHTMLを取得してみます。HTMLの解析だったらIEコンポでもいいのですが、こちらの方がメモリの消費が少なそう&ページ移動時にカチカチ言わないのでこっちの方がいいかなーぐらいな考えでし。IHTMLDocumentではなく、htmlfileでも同じことができるみたい?
#define IID_IHTMLDocument "{626FC520-A41E-11CF-A731-00A0C9082637}"#define IID_IHTMLDocument2 "{332C4425-26CB-11D0-B483-00C04FD90119}"#define IID_IHTMLDocument3 "{3050f485-98b5-11cf-bb82-00aa00bdce0b}"#define IID_IHTMLDocument4 "{3050f69a-98b5-11cf-bb82-00aa00bdce0b}"#define CLSID_HTMLDocument "{25336920-03F9-11CF-8FD0-00AA00686F13}"#usecom IHTMLDocument IID_IHTMLDocument CLSID_HTMLDocument#usecom IHTMLDocument2 IID_IHTMLDocument2 CLSID_HTMLDocument#usecom IHTMLDocument3 IID_IHTMLDocument3 CLSID_HTMLDocument#usecom IHTMLDocument4 IID_IHTMLDocument4 CLSID_HTMLDocument#comfunc IHTMLDocument4_createDocumentFromUrl 8 int, int, int#uselib "urlmon"#func CreateURLMoniker "CreateURLMoniker" int, wstr, int#uselib "ole32"#func CreateBindCtx "CreateBindCtx" int, int#define IID_IMoniker "{0000000f-0000-0000-C000-000000000046}"#define IID_IBindCtx "{0000000e-0000-0000-C000-000000000046}"#define IID_IPersistMoniker "{79eac9c9-baf9-11ce-8c82-00aa004ba90b}"#define STGM_READ 0x00000000#define STGM_READWRITE 0x00000002#usecom IPersistMoniker IID_IPersistMoniker#comfunc IPersistMoniker_Load 5 int, int, int, int#comfunc IPersistMoniker_Release 2#usecom IMoniker IID_IMoniker#comfunc IMoniker_Release 2#usecom IBindCtx IID_IBindCtx#comfunc IBindCtx_Release 2// http://eternalwindows.jp/browser/mshtml/mshtml01.htmlurl = "http://hsp.tv/"newcom pDoc, IHTMLDocument2ppMoniker = 0CreateURLMoniker 0, url, varptr(ppMoniker)newcom pMoniker, IID_IMoniker, -1, ppMonikerppBindCtx = 0CreateBindCtx 0, varptr(ppBindCtx)newcom pBindCtx, IID_IBindCtx, -1, ppBindCtxquerycom pPersistMoniker, pDoc, IPersistMonikerIPersistMoniker_Load pPersistMoniker, 0, ppMoniker, ppBindCtx, STGM_READWRITEdelcom pPersistMonikerdelcom pBindCtxdelcom pMoniker// 準備が完了するまで待つrepeatif pDoc("readyState") == "complete" : breakwait 10looppBody = pDoc("body")mes pBody("innerHTML")