COM connection point

Stefan Schukat SSchukat at dspace.de
Fri Mar 18 07:05:53 EST 2005


Just use

	obj = win32com.client.Dispatch(obj)

  Stefan


> -----Original Message-----
> From: python-list-bounces+sschukat=dspace.de at python.org
> [mailto:python-list-bounces+sschukat=dspace.de at python.org]On Behalf Of
> Oy Politics
> Sent: Wednesday, March 16, 2005 11:51 PM
> To: python-list at python.org
> Subject: COM connection point
> 
> 
> Hello:
> 
> I am building a COM client, with the ability to be called 
> back by events.
> The events can arrive independently from the server.  The 
> client method is
> called at the right time, so that is working.  However, one 
> parameter is
> itself a COM object, and I am having trouble with accessing 
> the properties
> of the parameter object.
> 
> Here is the output of what I have currently.
> 
> ---------- Python execute ----------
> event! <PyIDispatch at 0x7fb134 with obj at 0x403404>
> event! <PyIDispatch at 0x7fbbf4 with obj at 0x403404>
> event! <PyIDispatch at 0x7a6d24 with obj at 0x403404>
> 
> etc.  Obj is supposed to be my intended parameter.  However, 
> when I try to
> access its property, I get the following:
> 
> ---------- Python execute ----------
> pythoncom error: Python error invoking COM method.
> 
> Traceback (most recent call last):
>   File 
> "C:\PYTHON23\Lib\site-packages\win32com\server\policy.py", line 283,
> in _Invoke_
>     return self._invoke_(dispid, lcid, wFlags, args)
>   File 
> "C:\PYTHON23\Lib\site-packages\win32com\server\policy.py", line 288,
> in _invoke_
>     return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, 
> args, None, None)
>   File 
> "C:\PYTHON23\Lib\site-packages\win32com\server\policy.py", line 581,
> in _invokeex_
>     return func(*args)
>   File "E:\otsl\testprojects_folder\pythoncom\pyclihh2.py", 
> line 26, in
> OnMyEvent
>     print "event!", obj, obj.AProp
> exceptions.AttributeError: 'PyIDispatch' object has no 
> attribute 'AProp'
> 
> "QueryInterface" with the target IID gives the following:
> 
> exceptions.TypeError: There is no interface object registered 
> that supports
> this IID
> 
> "CastTo" gives this error:
> 
> exceptions.ValueError: This object can not be cast
> 
> Thanks a lot,
> -OY
> 
> 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list