On Thu, Jun 5, 2008 at 5:39 PM, Suraj Barkale <[EMAIL PROTECTED]> wrote: > On Tue, Jun 3, 2008 at 6:14 AM, Thomas Heller <[EMAIL PROTECTED]> wrote: >> >> I could solve the issue for my machine by repairing the Office 2003 >> installation, >> the following test script did not work before that and now runs fine. >> Whatever this means ;-) >> > No such luck for me. I am using a corporate install of Word 2002 which > has no "Repair" function in the installer. I reinstalled it but Scratch that. I completely uninstalled and then installed Office which cleared the problem. However, I spent a lot of time debugging the problem. I don't like that I don't know the root cause of the problem. So here are my notes from the debugging experience: 1. Read up COM fundamentals at http://www.codeproject.com/KB/COM/com_in_c1.aspx to get understand how comtype works. 2. comtypes directly calls functions in COM vtable instead of calling IDispatch.Invoke() as win32com does. I think this might be done for supporting COM which are interfaces not derived from IDispatch and/or speed. But I am not sure. 3. Best way to debug a COM call from comtypes is set a breakpoint in function CFuncPtr_call() on the line which calculates pProc from vtable (at line 3799 in _ctypes.c in current svn). You can set a condition comparing self->iid to the iid of the interface we are interested in. 4. Upon investigating invocation of f.Font in debugger, I found out that the vtable for the Find was corrupt. e.g. The 'Application' property had 0 as function address. By some lucky chance the Font property function pointer was pointing to a valid function which corrupted the vtable! 5. Strangely, IUnknown & IDispatch interface function pointers in the vtable were pointing to correct functions. So IDispatch.Invoke worked ok i.e. F.Invoke(11, comtypes.automation.DISPATCH_PROPERTYGET) call returned a valid Font object. 6. VS2008 Express Edition debugger refused to follow call into COM routines for some reasons. I should have tried WinDbg but I cut my losses at this point and reinstalled office from scratch. 7. I would like to add documentation to comtypes as far as I have understood it. I will be sending in some patches soon.
Regards, Suraj ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users