Get Associated icons for a file extension

S

Shane Story

I want to be able to get the icon associated with a certain file extension.

I can read the registry hkey_classes to get the ext. then look to the other
key for default icon.

How can I then extract the icon in file x at index 1 or whatever?

Again, I am not dealing with a file exactly but with a string path of the
file that has an extension.

I want to be able to take .pdf and get it's icon just by know .pdf, or .exe
or whatever.

Thanks,

Shane
 
T

Tom Shelton

I want to be able to get the icon associated with a certain file extension.

I can read the registry hkey_classes to get the ext. then look to the other
key for default icon.

How can I then extract the icon in file x at index 1 or whatever?

Again, I am not dealing with a file exactly but with a string path of the
file that has an extension.

I want to be able to take .pdf and get it's icon just by know .pdf, or .exe
or whatever.

Thanks,

Shane

ExtractIcon or ExtractIconEx come to mind.
 
T

Tom Shelton

I want to be able to get the icon associated with a certain file extension.

I can read the registry hkey_classes to get the ext. then look to the other
key for default icon.

How can I then extract the icon in file x at index 1 or whatever?

Again, I am not dealing with a file exactly but with a string path of the
file that has an extension.

I want to be able to take .pdf and get it's icon just by know .pdf, or .exe
or whatever.

Thanks,

Shane
Better yet - just remembered...

ExtractAssocitatedIcon
 
O

One Handed Man [ OHM# ]

Dang ?,

Forgive me and no offense meant, but you sound like a 1930's gold prospector
from the frozen Yukon wastelands

' dag nabbit! '

;-)

Regards - OHM#




Tom said:
Dang! I didn't know that one....

Regards - OHM# (e-mail address removed)
 
M

Mattias Sjögren

Dang! I didn't know that one....

I'm not sure it's worth knowing about, the code isn't very good
anyway. Doesn't compile with Option Strict On, and the SHFILEINFO
struct is incorrect (missing the StructLayout attribute for auto
charset).



Mattias
 
S

SStory

for anyone looking, the answer to this is found in an article on 1-14-04
between SStory and Ken Tucker
entitled... !Help with API call from vb. Must be trampling memory or
something!

The answer is to take Ken's class and use the flags that were in my original
function to get it just via exesion.

ie. for a .exe file pass ".exe" and get the right icon.

Shane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top