I've been meaning to look at how this works for some time,
so I took a few minutes to cook up an example (attached).

      Roger
import win32com
import pythoncom
from win32com.shell import shell, shellcon
import win32api, win32con, winerror

class SIOI:
        _reg_clsid_='{02844251-42C2-44CA-B43D-424FCE4F4660}'
        _reg_progid_='Python.IShellIconOverlayIdentifier'
        _reg_desc_='Python implementation of IShellIconOverlayIdentifier'
        _public_methods_ = ['GetOverlayInfo','GetPriority','IsMemberOf']
        _com_interfaces_=[shell.IID_IShellIconOverlayIdentifier, 
pythoncom.IID_IDispatch]
        def GetOverlayInfo(self):
                return (r'J:\Program 
Files\TortoiseCVS\icons\TortoiseCVS\TortoiseConflict.ico', 0, 
shellcon.ISIOI_ICONFILE)
        def GetPriority(self):
                return 50
        def IsMemberOf(self, fname, attributes):
                if fname.lower().find('overlay')!=-1:
                        return winerror.S_OK
                ## ??? Returning S_FALSE does not seem to work, overlay is 
always displayed ???
                return winerror.E_FAIL

if __name__=='__main__':
   import win32com.server.register
   win32com.server.register.UseCommandLine(SIOI)
   
keyname=r'Software\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\PyOverlayHandler'
   key=win32api.RegCreateKey(win32con.HKEY_LOCAL_MACHINE, keyname)
   win32api.RegSetValue(key, None, win32con.REG_SZ, SIOI._reg_clsid_)

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

Reply via email to