comtypes icon indicating copy to clipboard operation
comtypes copied to clipboard

Windows 11 error: COMError: (-2147467262, 'No such interface supported', (None, None, None, 0, None))

Open reckoner opened this issue 2 years ago • 2 comments

     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.

reckoner avatar Apr 29 '22 00:04 reckoner

Do you have some minimal reproducing code sample?

vasily-v-ryabov avatar Jun 18 '22 15:06 vasily-v-ryabov

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
)

kdschlosser avatar Dec 12 '22 05:12 kdschlosser