Hi,
This registry key represents the My Computer icon:
HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon.
Get the file name and icon number from this entry and use this code to
extract it:
// Class level entry
[DllImport("shell32.dll",CharSet=CharSet.Auto)]
public static extern int ExtractIconEx(string path, int idx, IntPtr[] sI,
IntPtr[] bI, uint op);
....
....
IntPtr[] li = new IntPtr[1]; // Large icon
IntPtr[] si = new IntPtr[1]; // Small icon
// Assuming the icon resides in Explorer.exe and its index is 0
ExtractIconEx(@"%SystemRoot%\Explorer.exe", 0, li, si, (uint)1);
// Draw icon on the form
this.CreateGraphics ().DrawIcon (Icon.FromHandle (li[0]), 0, 0);
HTH
Hi all
I am writing application for getting icon of drives and folder.
I want to get icon of 'My computer' through code.
Can some one help me.
Thanks in advance