473,320 Members | 1,978 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,320 software developers and data experts.

SHGetFileInfo question

how do i get the My Computer icon using SHGetFileInfo?
i've tried this:

SHGetFileInfo("", FILE_ATTRIBUTE_NORMAL, shinfo, Marshal.SizeOf(shinfo),
SHGFI_ICON + SHGFI_SMALLICON + SHGFI_DISPLAYNAME)

but it doesn't work.
i'm not sure what the filename for My Computer should be?

Jun 19 '07 #1
3 4127
You will have to first get the PIDL of My Computer using
SHGetSpecialFolderLocation and then pass this PIDL as the 1st parameter of
the SHGetFileInfo function.

---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------
".paul." <pa**@discussions.microsoft.comwrote in message
news:D5**********************************@microsof t.com...
how do i get the My Computer icon using SHGetFileInfo?
i've tried this:

SHGetFileInfo("", FILE_ATTRIBUTE_NORMAL, shinfo, Marshal.SizeOf(shinfo),
SHGFI_ICON + SHGFI_SMALLICON + SHGFI_DISPLAYNAME)

but it doesn't work.
i'm not sure what the filename for My Computer should be?

Jun 19 '07 #2
i tried it with a PIDL:

Dim tmpPidl As IntPtr

SHGetSpecialFolderLocation(0, CSIDL_DRIVES, tmpPidl)
SHGetFileInfo(tmpPidl, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_PIDL +
SHGFI_DISPLAYNAME + SHGFI_ICON + SHGFI_SMALLICON)

Marshal.FreeCoTaskMem(tmpPidl)

it gets the PIDL ok, but the SHGetFileInfo causes an error


"G Himangi" wrote:
You will have to first get the PIDL of My Computer using
SHGetSpecialFolderLocation and then pass this PIDL as the 1st parameter of
the SHGetFileInfo function.

---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------
".paul." <pa**@discussions.microsoft.comwrote in message
news:D5**********************************@microsof t.com...
how do i get the My Computer icon using SHGetFileInfo?
i've tried this:

SHGetFileInfo("", FILE_ATTRIBUTE_NORMAL, shinfo, Marshal.SizeOf(shinfo),
SHGFI_ICON + SHGFI_SMALLICON + SHGFI_DISPLAYNAME)

but it doesn't work.
i'm not sure what the filename for My Computer should be?



Jun 19 '07 #3
found it. thanks
it was a badly declared API

".paul." wrote:
i tried it with a PIDL:

Dim tmpPidl As IntPtr

SHGetSpecialFolderLocation(0, CSIDL_DRIVES, tmpPidl)
SHGetFileInfo(tmpPidl, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_PIDL +
SHGFI_DISPLAYNAME + SHGFI_ICON + SHGFI_SMALLICON)

Marshal.FreeCoTaskMem(tmpPidl)

it gets the PIDL ok, but the SHGetFileInfo causes an error


"G Himangi" wrote:
You will have to first get the PIDL of My Computer using
SHGetSpecialFolderLocation and then pass this PIDL as the 1st parameter of
the SHGetFileInfo function.

---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------
".paul." <pa**@discussions.microsoft.comwrote in message
news:D5**********************************@microsof t.com...
how do i get the My Computer icon using SHGetFileInfo?
i've tried this:
>
SHGetFileInfo("", FILE_ATTRIBUTE_NORMAL, shinfo, Marshal.SizeOf(shinfo),
SHGFI_ICON + SHGFI_SMALLICON + SHGFI_DISPLAYNAME)
>
but it doesn't work.
i'm not sure what the filename for My Computer should be?
>
>
>
Jun 19 '07 #4

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

Similar topics

3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
2
by: SamSpade | last post by:
I can do this and set the folder icon toi a closed folder SHGetFileInfo(subDir, 0, mSHI, mSHISize, Win32.Shell.SHGFI_ICON) subNode.ImageIndex = mSHI.iIcon subNode.SelectedImageIndex =...
3
by: Giuseppe Pezzella | last post by:
Hi In Windows every file have yours icon, so: how I get them ( Extension and Icon) and save in a imageList for use later in a ListView? In VB6 was SHGetFileInfo. In VB.NET? How I can...
0
by: Andre Viens | last post by:
Hello, I am using the following variation of code from <http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons to an imagelist for use in a listview: Private Structure...
1
by: AdrEsqu | last post by:
I am using the SHGetFileInfo to return the system icon. Is there anyway to return and display the icon with out having to return it to the ListView? I'm using the SHGetFileInfo in my SharePoint...
4
by: pagates | last post by:
Hello All, Before I post a console app that demonstrates this problem, can anybody see any problems with what I am doing below? private string GetFileType(string Path) { SHFILEINFO shfi =...
1
by: Nilam2477 | last post by:
I need to use SHGetFileInfo to display large icons.For small icon display it works fine. If i change the parameter to display large icon it does not display the file with large icon, it always...
0
by: Jeff Gaines | last post by:
I am using SHGetFileInfo to get the ImageIndex for an app I am writing in C Sharp running on XP Pro x64. If I compile it as x86 my Virtual Drives are called "Virtual Drive" with an ImageIndex of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.