Matt,
Due to things like shell extensions, the icon that can be returned might
not be what you expect based on the registry information. This is an
implementation detail, and should be avoided.
Rather, what you want to do is call the SHGetFileInfo function in the
windows API through the P/Invoke layer (you can get the definition from
http://www.pinvoke.net). You can pass it a wildcard for the filename (with
extension) and it will return you the icon for that file (you might possibly
get a more specific icon by passing the complete path of the file).
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Matt" <Ma********@covenanteyes.comwrote in message
news:iI******************************@t-one.net...
How do I get a Icon for display in a list view from just the file
extension?
If I have a file that exists on a local machine I can use
Icon.ExtractAssociatedIcon, but in this case the files are not on the
machine. The extension may give the incorrect informaton about file type,
but it is all the information I have.
There seems to be some information in the registry about this, but will I
always have permission to view this information in the registery?