From: Markus G. <m.g...@gm...> - 2008-11-04 09:50:09
|
On Mon, Nov 3, 2008 at 4:29 PM, MR Michael Robellard (5314) <mro...@ag...> wrote: > I don't believe IShellLink uses Dispatch/automation objects, so you will > have to import the tlb information > > Microsoft supplies the idl and h file in shobjidl.idl and shobjidl.h > You can use midl to create a tlb from it. Then you should be able to > load the tlb into comtypes. Thank you for your directions. I used midl ShObjIdl.idl to generate the ShObjIdl.tlb file. But when I try to load it with comtypes using from comtypes.client import GetModule GetModule('ShObjIdl.tlb') I get the following output: # Generating comtypes.gen._50A7E9B1_70EF_11D1_B75A_00A0C90564FE_0_1_0 # Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0 # Generating comtypes.gen.stdole C:\Python25\lib\site-packages\comtypes\tools\codegenerator.py:477: UserWarning: Structure __MIDL_IOleAutomationTypes_0004: PACKING FAILED: total alignment (8/64) warnings.warn(message, UserWarning) Traceback (most recent call last): File "auto.py", line 11, in <module> shell = GetModule( 'ShObjIdl.tlb' ) File "C:\Python25\lib\site-packages\comtypes\client\_generate.py", line 112, in GetModule mod = _CreateWrapper(tlib, pathname) File "C:\Python25\lib\site-packages\comtypes\client\_generate.py", line 187, in _CreateWrapper mod = _my_import(fullname) File "C:\Python25\lib\site-packages\comtypes\client\_generate.py", line 26, in _my_import return __import__(fullname, globals(), locals(), ['DUMMY']) File "C:\Python25\lib\site-packages\comtypes\gen\_50A7E9B1_70EF_11D1_B75A_00A0C90564FE_0_1_0.py", line 1101, in <module> assert sizeof(__MIDL_IOleAutomationTypes_0004) == 16, sizeof(__MIDL_IOleAutomationTypes_0004) AssertionError: 8 Any hints? Kind regards, Markus |