48x48 XP Icons

element

Active member
Joined
Oct 29, 2003
Messages
26
Location
Portsmouth, UK
Hey all,

OK Ive figured out extracting an icon from Shell32 using the ExtractIcon API like this:

Code:
    <DllImport("shell32.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Private Shared Function ExtractIcon _
        (ByVal hIcon As IntPtr, _
        ByVal lpszExeFileName As String, _
        ByVal nIconIndex As Integer) As IntPtr
    End Function

    Private m_Icon as Icon

    Private Sub GetIcon()
        hIcon = ExtractIcon(IntPtr.Zero, "shell32.dll", 4)
        m_Icon = Icon.FromHandle(hIcon).Clone
        DestroyIcon(hIcon)
    End Sub

    Private Sub picIcon_Paint(ByVal sender As Object, _
        ByVal e As System.Windows.Forms.PaintEventArgs) Handles picIcon.Paint

        e.Graphics.DrawIcon(m_Icon, 0, 0)

    End Sub

OK this isnt my exact code however it demonstates what is going on. I would like to know how to extract the 48x48 (with alpha) icon from Shell32.dll. ExtractIcon doesnt seem to have any parameters for what format icon you need. ExtractIconEx is no better.

Thanks in advance for any input, Tom
 
Back
Top