[python-win32] a question about word addin , IRibbonExtensibility, GetCustomUI, getImage, IPicture
Mark Hammond
skippy.hammond at gmail.com
Sun Mar 25 03:39:06 CEST 2012
On 24/03/2012 6:24 PM, shuwj wrote:
> hi,
>
> I'm writing an addin for ms word 2010. It will show a tab named JJ in
> which there are two buttons. one labels doo, the other labels doo2.
> doo2 should be displayed with customization image(edit.png) but don't
> show as expected.
>
> debugging with pythonwin trace collector debugging tool. there's a
> exception as following:
> --------------------------------------------
> in _GetIDsOfNames_ with '(u'GetImage',)' and '2048'
>
> in _Invoke_ with 1001 2048 1 (<PyIDispatch at 0x07052048 with obj at 0x03D51050>,)
> 0
> 0
> 0
> c_void_p(111734808) ddd
> pythoncom error: Python error invoking COM method.
>
> TypeError: Objects of type 'c_void_p' can not be converted to a COM VARIANT (but obtaining the buffer() of this object could)
> ---------------------------------------------
>
> can anybody give me some helps?
I believe a c_void_p is a ctypes construct which aren't supported by
pywin32. You need to convert it to a "normal" Python type. I'm
guessing it is binary data, so in py2k, you should be able to simply use
buffer(some_string_object). The error message seems to imply you may
even be able to use buffer(c_void_p_object), but I don't know how they
work well enough to suggest that will actually work.
Mark
More information about the python-win32
mailing list