Jeong-hun,
From the documentation for SHGetFileInfo:
If the uFlags parameter includes the SHGFI_USEFILEAT TRIBUTES 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 dwFileAttribute s parameter. This allows you to obtain
information about a file type by passing just the extension for pszPath and
passing FILE_ATTRIBUTE_ NORMAL in dwFileAttribute s.
So basically, pass "*.avi" to the function, along with
FILE_ATTRIBUTE_ NORMAL for the dwFileAttribute s parameter, and it will look
up the icon for an avi file.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard. caspershouse.co m
"Sin Jeong-hun" <ty*******@gmai l.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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.