How python ActiveX to access DHTML document?

angel dai4happy at yahoo.com
Sat May 8 21:39:49 EDT 2004


Thanx, but you mistook my meanings.
(1)I wrote ActiveX.
(2)The ActiveX will be embed in a html page.
(3)The ActiveX want to know the container html document's IDispatch pointer.

Your solution can only create a new document, and then control it.

Thanx again
angel
"Waldemar Osuch" <osuchw at ecn.ab.ca>
??????:c5b3dbee.0405081507.75d2125b at posting.google.com...
> "angel" <dai4happy at yahoo.com> wrote in message
news:<c7ibmb$24b2$1 at news.f.de.plusline.net>...
> > Hi
> >
> > I want to write an ActiveX by using python. And I know how do, but I
don't
> > know how python to access DHTML Document.If using cpp, it can be done by
> > following source.
> > /****/
> > CComPtr<IOleContainer> spContainer;
> > m_spClientSite->GetContainer(&spContainer);
> > CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spDoc(spContainer);
> > if (spDoc)
> >     spDoc->put_bgColor(CComBSTR(_T("pink")));
> > /****/
> > Who can tell me how to do the same in python? Thanx
> >
> > ps. I use win32com package.
> >
> > Thanx again
> > angel
>
> Assuming you want to have HTML Document within IE following should
> work from the command line.
>
> >>> from win32com.client import Dispatch
> >>> ie = Dispatch("InternetExplorer.Application")
> >>> ie.Visible = True
> >>> ie.Navigate('about:blank')
> >>> doc = ie.Document
> >>> doc.bgColor = "pink"
>
> I would also recommend running Tools->COM Makepy utility from Pythowin
> on Microsoft Internet Controls (for Internet Explorer)
> and Microsoft HTML Object Library (for DHTML Document)
>
> waldek





More information about the Python-list mailing list