Currently I'm working on VS Closed Document Reopen extension which works like in Web browsers. Reopens the last closed "tab" with a hotkey: Ctrl+Shift+T
I also added a Tool Window. Where the user can see the full Closed Documents History. What I would like to add to this WPF window is the actual icon of the file type in VS. Not Icons which are registered in Windows to those extensions. But the actual icons which are shown in the Solution Explorer pane. I want to get them form C# code as Icon/Bitmap/byte[] anything. So I could transform it to WPF BitmapSource and bind it to a ListView dynamically. So I don't want to download the VS Icons form the Internet...
The interface of the DTE2 object a bit convoluted, hard to find anything. And so far I was not able to find any solution. Any idea how can I do it?
Thanks for the answers and comments. Unfortunately all of them suggested things, which I stated in my question, I don't want to do. Like: download icons and use static files, or use the Operation System registered Icons.
So I continued my research and Looked into a VS Extension FileIcons. What this extension does is it replaces VS Icons with its own. And the Monikers.imagemanifest and IconIsMoniker caught my attention. Searching for that I ran into the Image service and Moniker documentation. This explains in details what is Moniker, how VS uses the Images, etc. The breakthrough was IVsImageService2 and there is a code example how to use KnownMonikers. A bit adjusting that example I was able to query and retry Icons registered in Visual Studio with a very simple code you can check it on Github.
//Acquire the IVsImageService2in the Package
var imageService = (IVsImageService2)Package.GetGlobalService(typeof(SVsImageService));
//Using the IVsImageService2 the query icons.
public Icon GetIcon(IClosedDocument document)
{
IVsUIObject uIObj = _vsImageService2.GetIconForFile(document.Name, __VSUIDATAFORMAT.VSDF_WINFORMS);
Icon icon = (Icon)GelUtilities.GetObjectData(uIObj);
return icon;
}