CodeItBetter Programming Another VB Programming Blog

How to extract associated Icon from EXE file

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'Graphics - How to extract associated Icon from EXE file

Option Explicit
 
'Add a PictureBox to your form.

Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal Y As Long, _
    ByVal hIcon As Long) As Long
Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, _
    ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
 
Private Sub Form_Load()
    Dim Path As String, strSave As String
    Dim returnl As Long, return2 As Long
    strSave = String(200, Chr$(0))
    Picture1.AutoRedraw = True
    return1 = ExtractIcon(Me.hwnd, "C:\WINDOWS\explorer.exe", 2)
    return2 = DrawIcon(Picture1.hdc, 0, 0, return1)
End Sub
Filed under: Graphics Leave a comment
Comments (1) Trackbacks (0)
  1. Hi there i want to know can you extract text from the exe instead of ico or images


Leave a comment


 

No trackbacks yet.