If you have the file extension you can get this from the registry, for example:
HKEY_CLASSES_ROOT
.avi
On my machine, the (Default)
value on that key is VLC.avi
.
Now find the key with that name:
HKEY_CLASSES_ROOT
VLC.avi
And there you should find a subkey called DefaultIcon
, which in my case has a (Default)
value of "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe",0
From here you should be able to get the icon from .exe
path.
Sometimes DefaultIcon
contains the path to a .dll
followed by an index. For these you could check this SO question for details on how to extract the image itself.