Extract icons..

hi guyz,
is there any way to extract icons from shell32.dll
there is a function naming extracticon from that dll..
but it returns handles to the icons..
can by any way i can extract them in a folder..
ashtified_85Idea
[297 byte] By [AshishYadav] at [2007-12-16]
# 1

This does a little more than you're asking, but I'm sure you can pull out the pertiant part:




Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As IntPtr, ByVal lpszExeFileName As String, ByVal nIconIndex As IntPtr) As IntPtr

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim IconName As String = GetIconName(".doc")
Dim TmpIndex = IconName.Substring(IconName.LastIndexOf(",") + 1)
Dim Index As IntPtr = New IntPtr(CInt(TmpIndex))
Dim hIcon As IntPtr = ExtractIcon(Process.GetCurrentProcess().Handle, IconName.Substring(0, IconName.LastIndexOf(",")), Index)
Dim ic As Icon = Icon.FromHandle(hIcon)
PictureBox1.Image = ic.ToBitmap()
PictureBox1.Image.Save("c:\new.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
End Sub
Private Function GetIconName(ByVal FileExt As String) As String
Dim ClassesKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot
Dim RegKey1 As Microsoft.Win32.RegistryKey
Dim RegKey2 As Microsoft.Win32.RegistryKey
Dim FileDesc As String

RegKey1 = ClassesKey.OpenSubKey(FileExt, False)
FileDesc = RegKey1.GetValue("", "")
RegKey2 = ClassesKey.OpenSubKey(FileDesc & "\DefaultIcon", False)

GetIconName = RegKey2.GetValue("", "")

RegKey1.Close()
RegKey2.Close()
ClassesKey.Close()
End Function[/code]

TaDa at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...