Jeong-hun,
From the documentation for SHGetFileInfo:
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.
So basically, pass "*.avi" to the function, along with
FILE_ATTRIBUTE_NORMAL for the dwFileAttributes parameter, and it will look
up the icon for an avi file.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Sin Jeong-hun" <ty*******@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
>I already found that I have to use SHGetFileInfo to get the System's
associated icon with that file. But what about I just want to get
associated icon for some specific extensions? For example, 'avi'.
Think of a P2P program. The user searched for 'avi', and the program
should show result avi files with associated icons but there's no
actual file on the users system. Maybe a workaround is to create a dumb
(0KB) temp.avi file somewhere on the users system, and then apply
SHGetFileInfo. I know that would work but looks crappy. Please teach me
a decent method. Thank you.