I need the "Printer Friendly Names", and I'm trying what "wqw" suggested in this thread:
How I can get printer name from device and printers IShellFolder?
The (legacy) code we use to get "Device and printers" printer names + icons is not exactly the same as the one posted in the thread, but very similar. When calling the GetTypedObjectForIUnknown as shown below, however, it results in an exception (something along the lines of "could not convert an object of type System.__ComObject to type System.Windows.IDataObject". What am I missing?
printersShellFolder.GetUIObjectOf(IntPtr.Zero, 1, rgelt, ref IID_IDataObject,
0, out var ppv);
var objDataType = Marshal.GetTypedObjectForIUnknown(ppv, DataObjectType);
var dataType = (IDataObject)objDataType;
var printerFriendlyName = dataType.GetData("PrinterFriendlyName");