MR Michael Robellard (5314) schrieb:
> Thank you for this great library. I have managed to do some great things
> with Python in Windows, however I am still hitting some stumbling
> blocks.
>  
> Currently I am trying to paste an object into a rich text edit control.
>  
> I can do this successfully in C++ by using the IRichEditOle interface
> that you get when you do:
>  
> disp = POINTER(IDispatch)()
> 
> result = win32api.SendMessage(hInput, EM_GETOLEINTERFACE, 0, addressof(disp))
> 
> I can QueryInterface on this interface to get an ITextDocument.
> 
> from comtypes.client import GetModule
> GetModule("riched20.dll")
> from comtypes.gen.tom import *
> td = disp.QueryInterface(ITextDocument)
> ts = td.Selection
> ts.Text = "Hello World"
> 
> This all works and sets the text in the Rich Edit Control to Hello World
> 
> What I can't figure out how to do is find a tlb for Either the
> IOleObject or IRichEditOle interfaces so that I can do something similar
> for them.
> 
> Do these exist?
> 
> Is there a better way to do the things I need to do?
> For instance on IOleObject I want to call SetClientSite

Michael,

please use text emails instead of html when posting to this list, it is
much easier to read.

To answer your question:  There are basically 3 possibilities, with
increasing difficulty:

- Find a typelibary somewhere on the internet; the VB guys also need
  typelibs to use com interfaces
- Compile one yourself from some IDL files in some MS SDKs, or write
  the idl code yourself and compile it
- Describe the interface in comtypes without using a typelib

It looks like a typelib (even with source) for IOleObject is available on this 
site:

http://www.vbaccelerator.com/typelib.htm

If you use these 'unofficial' typelibs I would recommend to move the generated 
modules
out of the comtypes\gen directory.

Thomas

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to