есть прога Restorator (если не ошибаюсь в названии) - отличная вещь по вытаскиванию всяческих иконок, курсоров, картинок и проч издевательств над приложениями типа exe, мне нравится
Private Const MAX_PATH = 260
Private Const SHGFI_DISPLAYNAME = &H200 ' get display name
Private Const SHGFI_EXETYPE = &H2000 ' return exe type
Private Const SHGFI_LARGEICON = &H0 ' get large icon
Private Const SHGFI_SHELLICONSIZE = &H4 ' get shell size icon
Private Const SHGFI_SMALLICON = &H1 ' get small icon
Private Const SHGFI_SYSICONINDEX = &H4000 ' get system icondex
Private Const SHGFI_TYPENAME = &H400 ' get type name
Private Const ILD_BLEND50 = &H4
Private Const ILD_BLEND25 = &H2
Private Const ILD_TRANSPARENT = &H1
Private Const CLR_NONE = &HFFFFFFFF
Private Const CLR_DEFAULT = &HFF000000
Private Type SHFILEINFO
hIcon As Long ' : icon
iIcon As Long ' : icondex
dwAttributes As Long ' : SFGAO_ flags
szDisplayName As String * MAX_PATH ' : display name (or path)
szTypeName As String * 80 ' : type name
End Type
Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" (ByVal pszPath As String, ByVal dwFileAttributes As Long, psfi As SHFILEINFO, ByVal cbFileInfo As Long, ByVal uFlags As Long) As Long
Private Declare Function ImageList_Draw Lib "comctl32.dll" (ByVal himl As Long, ByVal i As Long, ByVal hdcDst As Long, ByVal x As Long, ByVal y As Long, ByVal fStyle As Long) As Long
Private Declare Function ImageList_DrawEx Lib "comctl32.dll" (ByVal himl As Long, ByVal i As Long, ByVal hdcDst As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, ByVal rgbBk As Long, ByVal rgbFg As Long, ByVal fStyle As Long) As Long
Private Sub Form_Load()
 im hImage As Long, udtFI As SHFILEINFO
Me.AutoRedraw = True
hImage = SHGetFileInfo("c:\AUTOEXEC.BAT", ByVal 0&, udtFI, Len(udtFI), SHGFI_SYSICONINDEX Or SHGFI_LARGEICON)
ImageList_Draw hImage, udtFI.iIcon, Me.hDC, 0, 0, ILD_TRANSPARENT
ImageList_DrawEx hImage, udtFI.iIcon, Me.hDC, 32, 0, 32, 32, CLR_NONE, CLR_DEFAULT, ILD_BLEND50
End Sub
кида на форму 2 баттона, коммон диалог и пикчербокс
код извлекает иконку из ехе файла
Option Explicit Private Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias _ "ExtractAssociatedIconA" (ByVal hInst As Long, _ ByVal lpIconPath As String, lpiIcon As Long) As Long Private Declare Function DrawIcon Lib "user32" (ByVal hDC As Long, _ ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long Private Declare Function DestroyIcon Lib "user32" _ (ByVal hIcon As Long) As Long
Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
'Вызывание API фунций Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long Private Const SRCCOPY = &HCC0020 Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function CloseClipboard Lib "user32" () As Long Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long Private Declare Function EmptyClipboard Lib "user32" () As Long Private Const CF_BITMAP = 2 Private Sub cmdExit_Click() End End Sub Private Sub cmdOpen_Click() CD.ShowOpen 'Открываем Command Diaog Me.Caption = CD.FileName 'Присваеваем заголовку окна Путь\Имя Файла pctIcon.Cls 'Очищаем PictureBox От Старой Иконки Dim sPath As String, hIcon As Long, nIcon As Long 'Присваеваем Переменные sPath = Me.Caption 'Берем путь с заголовка окна hIcon = ExtractAssociatedIcon(App.hInstance, sPath, nIcon) 'Забираем Верхнюю Иконку DrawIcon pctIcon.hDC, 0&, 0&, hIcon 'Вставляем иконку в PictureBox DestroyIcon hIcon 'Берём Иконку CopyEntirePicture pctIcon 'Вставляем иконку в буфер обмена 'Теперь Можно Вставлять Иконку Хоть Куда End Sub 'Функция Тута (Копирование Рисунка) Public Function CopyEntirePicture(ByRef objFrom As Object) As Boolean Dim lhDC As Long Dim lhBMP As Long Dim lhBMPOld As Long Dim lWidthPixels As Long Dim lHeightPixels As Long lhDC = CreateCompatibleDC(objFrom.hDC) If (lhDC <> 0) Then lWidthPixels = objFrom.ScaleX(objFrom.ScaleWidth, objFrom.ScaleMode, vbPixels) lHeightPixels = objFrom.ScaleY(objFrom.ScaleHeight, objFrom.ScaleMode, vbPixels) lhBMP = CreateCompatibleBitmap(objFrom.hDC, lWidthPixels, lHeightPixels) If (lhBMP <> 0) Then lhBMPOld = SelectObject(lhDC, lhBMP) BitBlt lhDC, 0, 0, lWidthPixels, lHeightPixels, objFrom.hDC, 0, 0, SRCCOPY SelectObject lhDC, lhBMPOld OpenClipboard 0 EmptyClipboard SetClipboardData CF_BITMAP, lhBMP CloseClipboard End If DeleteObject lhDC End If End Function