473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Get Associated icons for a file extension

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
Nov 20 '05 #1
7 8045
On 2003-12-12, Shane Story <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote:
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.

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #2
On 2003-12-12, Shane Story <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote:
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

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #3
Shane,
I want to be able to get the icon associated with a certain file extension.


HOW TO: Use the SHGetFileInfo Function to Get the Icons That Are
Associated with Files in Visual Basic .NET
http://support.microsoft.com/?kbid=319340

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #4
On 2003-12-12, Mattias Sjögren <ma********************@mvps.org> wrote:
Shane,
I want to be able to get the icon associated with a certain file extension.


HOW TO: Use the SHGetFileInfo Function to Get the Icons That Are
Associated with Files in Visual Basic .NET
http://support.microsoft.com/?kbid=319340

Mattias


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

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #5
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 Shelton wrote:
On 2003-12-12, Mattias Sjögren <ma********************@mvps.org>
wrote:
Shane,
I want to be able to get the icon associated with a certain file
extension.


HOW TO: Use the SHGetFileInfo Function to Get the Icons That Are
Associated with Files in Visual Basic .NET
http://support.microsoft.com/?kbid=319340

Mattias


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


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #6
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #7
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
"Shane Story" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:Or**************@TK2MSFTNGP11.phx.gbl...
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

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: andrea.gavana | last post by:
Hello NG, I have searched everyweher, and I am not able to find a solution... basically, I am constructing a GUI with wxPython, in which I have a list. In this list control, I have some file. I...
1
by: moquet.laurence | last post by:
In the registry, File extension's icons are stored like this : filename,resource_number. How can I extract the specific resource number from this file (using .Net framework)?
2
by: Matthias S. | last post by:
Hi, I need to find the Icons associated with a given file extension. I guess there are registry entries for that. Is there a generic way of getting them? Thanks a lot in advance, Matthias
2
by: Alexander Keßler | last post by:
Hi, I want to programm some kind of Explorer like the Windows Explorer. And I want to know how can i get the same Icons/Symbols for the files and directories like the Windows Explorer uses. ...
7
by: Alexander Keßler | last post by:
Hi, I asked u this morning: --------------------------------------- I want to programm some kind of Explorer like the Windows Explorer. And I want to know how can i get the same Icons/Symbols...
1
by: Víctor | last post by:
I'm doing a kind of file explorer with some additional funcionalities. The problem is that I'm not able to draw file extension icons in a ListView. I know how obtain icons, but when I try to draw...
1
by: Progalex | last post by:
Hi guys.. How can I obtain the associated icon for each file extension registered on my machine via Visual Basic 2005 code? Many thanks.. Alessandro
4
by: techspirit | last post by:
Hi all, 1) I found out from the vb.net group that it is possible to get an associated icon for a file. My requirement is to display all programs from the Start Menu for the user along with the...
1
by: gevald123 | last post by:
I'm storing system files in a sql server database, as "image" datatype fields. In my front end (vb .net 1.1) I'd like to display these files in a listview with the "Windows Explorer" feel and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.