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 Sub Command1_Click()
Dim hIcon As Long
hIcon = ExtractAssociatedIcon(0, "Notepad.exe", 0)
If hIcon = 0 Then Exit Sub
Call DrawIcon(Picture1.hDC, 0, 0, hIcon)
End Sub

Private Sub Command2_Click()
SavePicture Picture1.Picture, "C:/pic1.ico"
End Sub