comtypes
comtypes copied to clipboard
Windows 11 error: COMError: (-2147467262, 'No such interface supported', (None, None, None, 0, None))
24 )
25 pObject = POINTER(cls)()
---> 26 pServiceProvider.QueryService(
27 clsid or cls._iid_,
28 cls._iid_,
29 pObject,
30 )
31 return pObject
COMError: (-2147467262, 'No such interface supported', (None, None, None, 0, None))
This works fine on my windows 10 machine. Not sure what to do with this on Windows 11.
Do you have some minimal reproducing code sample?
The following code in an incorrect way to call QueryService if QueryService is from the IServiceProvider class
pServiceProvider.QueryService(
clsid or cls._iid_,
cls._iid_,
pObject,
)
you need to only pass the IID of the service and also the interface Not a pointer to the interface.
so as follows
pObject = pServiceProvider.QueryService(
cls._iid_,
cls
)