Thomas Lohse wrote:
Hello,

could anyone provide some assistance in using ShellIconOverlay-Handlers
with pythoncom. I implement a kind of file explorer and would like to
call the ShellIconOverlay-Handlers (registered by TortoiseSVN) of the
windows explorer to visualize SVN-states. (I'm NOT about to implement my
own handler).

I can successfully CoCreateInstance these handlers and receive an
implementation of IShellIconOverlayIdentifier interface.
GetOverlayInfo() and GetPriority() both work fine on the interface, but
IsMemberOf(path, attributes) always returns None instead of S_OK,
S_FALSE, E_FAIL or an exception. This is the case whether the passed
path exists or not and is independent of the passed attributes.

Why does IShellIconOverlayIdentifier::IsMemberOf() not work? Any advice
or hint would be very appreciated.


Yours sincerely,
Thomas


My approach to using ShellIconOverlay handlers:

import sys
import pythoncom
import win32api, win32con

from win32com.shell import shell
from winerror import S_OK, S_FALSE, E_FAIL


def CallIconOverlayHandler():
   path = sys.argv[1] if len(sys.argv) > 1 else u"C:\\foo"
# Query CLSID for 1st registered IconOverlayHandler
   # (there should be handler "Offline Files" at least, since included
in Win)
   regKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,

ur"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayId
entifiers")
   name = win32api.RegEnumKey(regKey, 0)
   clsId = win32api.RegQueryValue(regKey, name)
   win32api.RegCloseKey(regKey)
print u"Using %s: %s" % (name, clsId)
   ovHdl = pythoncom.CoCreateInstance(clsId, None,
                                      pythoncom.CLSCTX_INPROC_SERVER,
shell.IID_IShellIconOverlayIdentifier)

   #Works fine
   print u"GetOverlayInfo():", ovHdl.GetOverlayInfo()
   print u"GetPriority():", ovHdl.GetPriority()

   #Problem: IsMemberOf returns always None
   print u"IsMemberOf(\"%s\", 0):" % path, ovHdl.IsMemberOf(path, 0)
print u"Done."

if __name__ == "__main__":
   CallIconOverlayHandler()

Try upgrading to build 212.  There was a bug in this method
that was fixed recently.

           Roger

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

Reply via email to