I need to get the icons associated with file types not the file name.
I store in my database files with the type=> filename.type, but those files need not exist on the hard disk.
Therefore I need to pass the type and get the icon for it
What do you suggest?
You can call SHGetFileInfo()
.
If the file does not exist then you will need to use the SHGFI_USEFILEATTRIBUTES
flag:
If the uFlags parameter includes the SHGFI_USEFILEATTRIBUTES flag, this parameter does not have to be a valid file name. The function will proceed as if the file exists with the specified name and with the file attributes passed in the dwFileAttributes parameter. This allows you to obtain information about a file type by passing just the extension for pszPath and passing FILE_ATTRIBUTE_NORMAL in dwFileAttributes.
As usual, pinvoke.net has the necessary information to get to this from managed code.