I'm afraid that IExtractImage is not yet exposed by pywin32 - it would not
be too hard if you are interested in testing a new implementation.  Note
that IExtractIcon is exposed - that may nor may-not work for you though.

Cheers,

Mark
  -----Original Message-----
  From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf
Of Steven James
  Sent: Wednesday, 18 April 2007 11:15 PM
  To: python-win32@python.org
  Subject: [python-win32] How to use IExtractImage in python


  I am attempting to add a simple thumbnail preview in a wxpython app I'm
putting together. IExtractImage seems to be the way to access the thumbnails
that Windows Explorer uses.

  (I can't use PIL or similar because I'm previewing AutoCAD .dwg files).

  I am adapting some Delphi COM code (from here) as follows--i've removed
the Malloc and other unnecessary statements:

  --begin delphi code--

  if NOERROR = SHGetDesktopFolder(DesktopFolder) then
   DesktopFolder.ParseDisplayName(0, nil, 'C:\WINNT', Eaten,
      ItemIDList, Attributes);
    DesktopFolder.BindToObject(ItemIDList, nil, IShellFolder,
      TargetFolder);
    TargetFolder.ParseDisplayName(0, nil, 'delphi_wallpaper1024.bmp', Eaten,
      ItemIDList, Attributes);
    TargetFolder.GetUIObjectOf(0, 1, ItemIDList, IExtractImage,
      nil, XtractImg);
    Malloc.Free(ItemIDList);

  --end delphi code--


  --begin python adaption--

          testPath = "C:\\"
          testFileName = "test.dwg" #also have tried test.bmp, test.png
          iSHFolder = shell.SHGetDesktopFolder()
          eaten, idList, attr = iSHFolder.ParseDisplayName(0, None,
testPath)
          targetFolder = iSHFolder.BindToObject (idList, None,
shell.IID_IShellFolder)
          eaten, targetIdList, attr = targetFolder.ParseDisplayName(0, None,
testFileName)
          pprint ([eaten, targetIdList, attr])
          extractImage = targetFolder.GetUIObjectOf(0, [targetIdList],
                  pythoncom.MakeIID('{BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}'
),0)

  --end python adaptation--

  The python code fails on the last statement, throwing the following
exception:

  TypeError: There is no interface object registered that supports this IID

  Any ideas on how to use this interface in python? I have googled for
hours.

  Thanks,
  Steven James

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to