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

Adding MyComputer Icon to TreeView - Check code

Below is how I add the drives to an explorer like TreeView.

What I don't know how to do is to add an Icon for MyComputer.

Any help would be appreciated.

Dim SysIconList% = WinApi.SHGetFileInfo(IntPtr.Zero, 0, SFI,
Marshal.SizeOf(SFI), Win32.Shell.SHGFI_SYSICONINDEX +
Win32.Shell.SHGFI_SMALLICON)

SendMessage(tvFolders.Handle, TVM_SETIMAGELIST, 0, SysIconList)

Dim MyComputerNode As TreeNode = tvFolders.Nodes.Add(mMY_COMPUTER)

'MyComputerNode.ImageIndex = ?????

For Each Drive As String In Directory.GetLogicalDrives() 'Add Logical Drives
into TreeView

winapi.SHGetFileInfo(Drive, 0, mSHI, mSHISize, Win32.Shell.SHGFI_ICON)

Dim Subnode As TreeNode = MyComputerNode.Nodes.Add(Split(Drive, "\")(0))

Subnode.ImageIndex = mSHI.iIcon

Next
Nov 20 '05 #1
0 1207

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

Similar topics

1
by: Jonas L | last post by:
I have created a derived version of a normal form, e.g. called MyForm (public class MyForm : System.Windows.Forms.Form). The form is simply specifing a standard icon that we use within the company....
2
by: SamSpade | last post by:
I found the icons for files and folders using Call SHGetFileInfo(subDir, 0, mSHI, mSHISize, Win32.Shell.SHGFI_ICON) but can't find the system icon for MyComputer. Later I'd like to also find...
26
by: Simon Jefferies | last post by:
Hello, I am trying to add an item to a checked list box, like: clbList.Items.add("Hello",true) I get an error back: Run-time exception thrown: System.ArgumentOutOfRangeException -...
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...
0
by: Mark | last post by:
Hi Folks (VS .NET 2005 on Windows XP...) I'm using Drawing.Icon.ExtractAssociatedIcon to extract the icon from a filepath etc. to be added to an imagelist used by a treeview. Everything...
1
by: Manfred | last post by:
Hello I added some icons to an imagelist. I checked first the image size and image depth and adjusted the settings according in the imagelist before adding the icon. The icon still gets...
1
by: Taptu¶ | last post by:
How can I insert custom icon in my treeview tag ? I use custom drawing with my control but I can't use images in this field. I need to insert icon and next I must detect onClick event (on tag...
2
by: =?Utf-8?B?QWxsYW4gTWljaGFlbHM=?= | last post by:
Hello, I have some basic questions regarding Icons. The ms-help page for System.Drawing.Icon ...
1
by: =?Utf-8?B?QWRhbQ==?= | last post by:
I'm having a problem loading an Icon into an ImageList. When I load the icon directly it works fine, like this: Icon sourceIcon = << Get an icon from somewhere... >>;...
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...
1
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.