views:

253

answers:

1

I've read http://stackoverflow.com/questions/462270/get-file-icon-used-by-shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great.

However, Outlook uses ".msg" for mail and appointment items (if you drag an email and drag an event onto your desktop, the resulting icons are different). I noticed that if I use the registry method, the standard envelope icon is at index 17 of C:\WINDOWS\Installer{90120000-0011-0000-0000-0000000FF1CE}\outicon.exe (on my XP machine running Outlook 2007) - and, conveniently enough, the appointment icon is at index 18. I can hardcode 18 when extracting the icon, but that sounds very flimsy.

Given the filename of an email or an appointment (but not the actual file), and knowledge that it is an email or an appointment, does anybody know how to get the correct icon, either through the shell or through the registry?

Of course, if I had the actual file handy, I could just use Icon.ExtractAssociatedIcon, but in the system I'm working on, we're showing a list of files that are stored elsewhere and downloading each of them beforehand is not possible.

+1  A: 

If you know when it an appointment or a mail, could you not pass "appointment.ics" into your SHFileInfo funnction and get the the right icon ? Marcus

76mel