- 390 名前:デフォルトの名無しさん mailto:sage [2007/11/09(金) 21:53:27 ]
- // 2. エレメントに直接スタイルを追加してみる方法
CComPtr<IDispatch> spIDisp; spIDisp.Attach(GetHtmlDocument()); CComQIPtr<IHTMLDocument2> spIDom(spIDisp); CComPtr<IHTMLElementCollection> spElemCol; spIDom->get_all(&spElemCol); spIDisp.Release(); spElemCol->tags(CComVariant(_T("P")), &spIDisp); CComQIPtr<IHTMLElementCollection> spElemCol2(spIDisp); for ( int idx = 0 ; ; idx++ ) { spIDisp.Release(); spElemCol2->item(CComVariant(idx), CComVariant(), &spIDisp); if ( !spIDisp ) break; CComQIPtr<IHTMLElement> spElem(spIDisp); CComBSTR clsname; BSTR bstr; spElem->get_className(&bstr); clsname.Attach(bstr); if ( clsname != _T("test") ) continue; CComPtr<IHTMLStyle> spStyle; spElem->get_style(&spStyle); spStyle->put_color(CComVariant(_T("red"))); }
|

|