Problem
IShellItem2.GetString
returns E_NOTFOUND for PKEY_Devices_Status1
and PKEY_Devices_Status2
for all devices on Windows 7 (build 6.1.7601). This is unexpected because they were introduced in Windows 7 and they work in Windows 10.
I’m showing a list of printers by enumerating the shell items in Microsoft.DevicesAndPrinters
, checking the PKEY_Devices_CategoryIds
, and showing the icon and PKEY_Devices_FriendlyName
, PKEY_Devices_Status1
, and PKEY_Devices_Status2
. All of these list Windows 7 as their lowest supported OS except PKEY_Devices_CategoryIds
which lists only Windows 10 but works without a problem (and indeed is vital) on Windows 7.
Everything works on Windows 10, besides a random 0 to 200 ms delay where the status properties are not found which is easily solved by polling until they become available.
Trying to fake the status messages on Windows 7 by falling back on GetPrinter
and EnumJobs
is not a good solution because I’ll never be able to match Windows’ localization of the display string.
Images
These are the Windows 7 Devices and Printers status lines for which I expect to be able to get shell display strings, but there seems to be no way to access them:
These are the Windows 10 Devices and Printers status lines which are returned as expected by PKEY_Devices_Status1
and PKEY_Devices_Status2
:
Summary
I’m lost as to how to troubleshoot further. Am I accessing the shell item properties the wrong way? Do I need a magic flag somewhere? Is this an impossible task on Windows 7?