Re: Connection Points Implementation

Thomas Heller <theller-w9fvoj/KL/[email protected]> Thu, 19 May 2005 22:16:37 +0200
Newsgroups gmane.comp.python.ctypes.devel
Message-ID <[email protected]>
(Hope this gets through, there are some problems with the SF mailing 
lists currently)

Shane Holloway (IEEE) schrieb:

> Thomas,
>
> I wasn't sure if you had the time to look at it, but I got a minimal 
> implementation[1] of server connection points implemented.  The only 
> issue I ran into was calling event through _dispmethod_?  Can you 
> suggest the approach for this?
>
> .. [1]: 
> http://sourceforge.net/tracker/index.php?func=detail&aid=1203889&group_id=71702&atid=532156 
>
>
Shane, thanks for the patch.  I have my own version of this patch, but 
yours is probably better.  My own one only supports a single outgoing 
interface, but yours looks like it supports more of them.  As a bonus, 
my version actually supports to 'fire' the events, and even from 
different threads.  I'll try to merge both and check them into CVS.  The 
approach to fire the events is quite simple, here it is (I hope 
thunderbird doesn't destroy the formatting):

    def Fire_Event(self, name, *args, **kw):
        # call this method to notify the active advise connections
        # we could cache the memids...
        from ctypes.com.git import GetInterfaceFromGlobal
        memid = c_int()
        self._typeinfo.GetIDsOfNames(byref(c_wchar_p(name)), 1, 
byref(memid))
        for p in self._connections.values():
            if self._multi_threading:
                p = GetInterfaceFromGlobal(p, self._sink_interface)
            params = DISPPARAMS()
            params.cArgs = len(args)
            rgvarg = params.rgvarg = (VARIANT * len(args))()
            for i, a in enumerate(args):
                rgvarg[i].value = a
            p.Invoke(memid.value,
                     byref(GUID()),
                     0, # lcid
                     DISPATCH_METHOD, # wFlags
                     byref(params),
                     None, # pVarResult
                     None, # pExcepInfo
                     None) # puArgError
        return S_OK

>
> Secondly, I was wondering if there is a wiki/page summarizing your 
> vision for comtypes?

Not yet, only code. There are some pages in the 'py2exe and ctypes' 
wiki, but the ctypes.com stuff is quite old and not up to date.

>  I've been lamenting the state of COM in python for a while now.  I'm 
> not a big COM fan (or developer) anymore, but every once in a while a 
> client needs us to interface with COM, and I'd like to help make that 
> more pleasant for me *and* everyone else.  ;)  I know you learned 
> quite a bit from ctypes.com, and that knowledge is going into 
> comtypes.  How do you see other developers helping you in comtypes?
>
We'll see.  For COM, I have received a small patch here and there, but 
not more.

> Thanks,
> -Shane Holloway
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
> _______________________________________________
> Ctypes-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ctypes-devel




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click