[python-win32] how to access IID_IPropertyStore interface

Piotr Miedzik qermit at sezamkowa.net
Sun May 2 14:37:13 EDT 2021


I'm trying to write Jump Lists without PyQt5. In fact I'm rewriting
this source https://github.com/qt/qtwinextras/blob/18bee52fe48500bca46de7e47d134940c48b524c/src/winextras/qwinjumplist.cpp#L141

To set title or separator I need to access `IID_IPropertyStore`
interface (`{886D8EEB-8CF2-4446-8d02-CDBA1DBDCF99}`)

But I cannot find it in pywin32.

```
from win32com.shell import shell
import pythoncom

jumplist = pythoncom.CoCreateInstance(
    shell.CLSID_DestinationList,
    None,
    pythoncom.CLSCTX_INPROC_SERVER,
    shell.IID_ICustomDestinationList)

jumplist.BeginList()
collection = pythoncom.CoCreateInstance(
    shell.CLSID_EnumerableObjectCollection,
    None,
    pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IObjectCollection)

link = pythoncom.CoCreateInstance(
    shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER,
shell.IID_IShellLinkW)

link.SetDescription("Test description")
link.SetPath("C:\\Windows\\System32\\cmd.exe")
# link.SetIconLocation("C:\\Windows\\System32\\cmd.exe", 0)
collection.AddObject(link)

# jumplist.AppendCategory("Test", collection)
jumplist.AddUserTasks(collection)
jumplist.CommitList()
```

It gives me error when I'm executing `AddUserTasks`
```
python.exe cleaner.py
Traceback (most recent call last):
  File "cleaner.py", line 25, in <module>
    jumplist.AddUserTasks(collection)
pywintypes.com_error: (-2147024809, 'The parameter is incorrect.', None, None)
```
Is there a way to generate missing interface?
-- 
Piotr Miedzik


More information about the python-win32 mailing list