VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple program to extract an icon from any file

by Mohannad Sulaiman Abu Sall (4 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 21st September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Simple program to extract an icon from any file

API Declarations



Private Const MAX_PATH = 260

Private Type SHFILEINFO
hIcon As Long ' out: icon
iIcon As Long ' out: icon index
dwAttributes As Long ' out: SFGAO_ flags
szDisplayName As String * MAX_PATH ' out: display name (or path)
szTypeName As String * 80 ' out: type name
End Type

Private Const SHGFI_ICON = &H100
Private Const SHGFI_LARGEICON = &H0
Private Const SHGFI_SMALLICON = &H1


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 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

Dim Fico As SHFILEINFO


Rate Simple program to extract an icon from any file




 Pic.Picture = LoadPicture()
 SHGetFileInfo File1.List(File1.ListIndex), 0, Fico, Len(Fico), SHGFI_ICON + SHGFI_LARGEICON
 Pic.AutoRedraw = True
 DrawIcon Pic.hdc, 0, 0, Fico.hIcon
 Pic.Picture = Pic.Image
 Pic.AutoRedraw = False

End Sub


Download this snippet    Add to My Saved Code

Simple program to extract an icon from any file Comments

No comments have been posted about Simple program to extract an icon from any file. Why not be the first to post a comment about Simple program to extract an icon from any file.

Post your comment

Subject:
Message:
0/1000 characters