On 05/11/2008, Thomas Heller <[EMAIL PROTECTED]> wrote: > > Cool! The only thing I would suggest to change > is to use QueryInterface instead of cast:
Aha. Thanks, thought there must be an easier way of doing that. On 05/11/2008, Markus Gritsch <[EMAIL PROTECTED]> wrote: > On Wed, Nov 5, 2008 at 1:19 PM, Thomas Heller <[EMAIL PROTECTED]> wrote: > > > > Does the solution that Martin posted not work for you? > > > I am developing on a Windows XP machine, but test the py2exe-packed > binaries also on Windows 2000 and Windows 98 virtual machines. You'll be pleased to hear then that I just tried it on a real win98se box, with python 2.4.4/ctypes 1.0.2/comtypes 0.5.2 and it worked fine (after swapping cmd.exe for command.com that is). > Traceback (most recent call last): > > File "test.py", line 5, in <module> > AttributeError: 'POINTER(IUnknown)' object has no attribute 'CreateShortcut' Obvious stab-in-the-dark here, try: from comtypes.gen import IWshRuntimeLibrary +ws = ws.QueryInterface(IWshRuntimeLibrary.IWshShell2) shortcut = ws.CreateShortcut("test_shortcut.lnk").QueryInterface( IWshRuntimeLibrary.IWshShortcut) Also make sure you're on the latest comtypes version, I vaugely remember the code generator messing me around a bit before I upgraded (to 0.4.2 that would have been, though). > Maybe the version of the Windows Script Host installed there is too > old to contain the CreateShortcut functionality. Therefore I would > prefer not to depend on the Windows Script Host. This strikes me as a misdiagnosis, problem looks to be with the generated interface, not the underlying library in win98. Martin ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users