Luke Kenneth Casson Leighton schrieb:
> i've been working on a port of http://pyjd.org to MSHTML for the past
>  week, and, thanks to the number of bits of example code that various
>  people have posted over the years, comtypes has been the main reason
>  why i've managed to get so far, so quickly.  i've posted about this on
>  python-win32 but i also wanted to let people here know (mostly for
>  archive / search purposes)
> 
>  code is here:
>  http://pyjamas.svn.sourceforge.net/viewvc/pyjamas/trunk/pyjd/
> 
>  relevant files: mshtml.py and mshtmlevents.py - this latter is a
>  hacked-up much older version of comtypes.client.events which contained
>  the last piece of the puzzle needed to solve the event handling.
> 
>  there are three approaches in MSHTML event handling, and you _need_ them all:
> 
>  * the usual one that everyone's solved: receiving Document events from
>  eeverything, usually into one class.  this is what
>  comtypes.client.GetEvents does for you: drops all events into your
>  lap.
> 
>  * single-event dispatching, using IHTMLElement.attachEvent.  this one
>  was tricky, and required the [much] older comtypes.client._events.py
>  code, to solve
> 
>  * setting a property of a COM Interface e.g. IHTMLElement.onclick =
>  <foo> - this was obvious when you think about it, from reading the
>  MSDN, but... :)
> 
>  anyway - read the python-win32 posting for details but the core thing
>  is that you _need_ all three styles, for different reasons.
>  IHTMLWindow and IHTMLDocument use the first style; IHTMLElement the
>  second, and XMLHttpRequest will take the third style.
> 
>  ... yes, you heard right: i actually got XMLHttpRequest COM objects to
>  work with python :)

Sounds very cool - congratulations for getting it to work.  Unfortunately
I have no time to look deeper into your stuff ;-(

Always astonished what powerfull stuff people create with comtypes and ctypes.
-- 
Thanks,
Thomas


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to