| | |
Retrieve Icon From Exe File
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
declared on module...
vb Syntax (Toggle Plain Text)
Private Const SHGFI_DISPLAYNAME = &H200, SHGFI_EXETYPE = &H2000, SHGFI_SYSICONINDEX = &H4000, SHGFI_LARGEICON = &H0, SHGFI_SMALLICON = &H1, SHGFI_SHELLICONSIZE = &H4, SHGFI_TYPENAME = &H400, ILD_TRANSPARENT = &H1, BASIC_SHGFI_FLAGS = SHGFI_TYPENAME Or SHGFI_SHELLICONSIZE Or SHGFI_SYSICONINDEX Or SHGFI_DISPLAYNAME Or SHGFI_EXETYPE Private Type SHFILEINFO hIcon As Long: iIcon As Long: dwAttributes As Long: szDisplayName As String * MAX_PATH: szTypeName As String * 80 End Type Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" (ByVal pszPath As String, ByVal dwFileAttributes As Long, psfi As SHFILEINFO, ByVal cbSizeFileInfo 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 hDCDest As Long, ByVal X As Long, ByVal Y As Long, ByVal Flags As Long) As Long Private shinfo As SHFILEINFO, sshinfo As SHFILEINFO Public Enum IconRetrieve ricnLarge = 32 ricnSmall = 16 End Enum
Last edited by Estella; Apr 21st, 2008 at 2:14 pm.
Add in your declaration :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Const MAX_PATH As Integer = 260
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
add this following code in your module :
this function will called like this :
PicIcon32 is picturebox
hope this helps...
vb Syntax (Toggle Plain Text)
Public Sub RetrieveIcon(fName As String, DC As PictureBox, icnSize As IconRetrieve) Dim hImgSmall, hImgLarge As Long 'the handle to the system image list DC.Cls Select Case icnSize Case ricnSmall hImgSmall = SHGetFileInfo(fName$, 0&, shinfo, Len(shinfo), BASIC_SHGFI_FLAGS Or SHGFI_SMALLICON) Call ImageList_Draw(hImgSmall, shinfo.iIcon, DC.hDC, 0, 0, ILD_TRANSPARENT) Case ricnLarge hImgLarge& = SHGetFileInfo(fName$, 0&, shinfo, Len(shinfo), BASIC_SHGFI_FLAGS Or SHGFI_LARGEICON) Call ImageList_Draw(hImgLarge, shinfo.iIcon, DC.hDC, 0, 0, ILD_TRANSPARENT) End Select End Sub
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
RetrieveIcon lblPath.Caption, PicIcon32, ricnLarge
hope this helps...
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
yes, got it.
Working like a charm.
Thank you very much
Working like a charm.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
RetrieveIcon "C:\Program Files\Winamp\winamp.exe", PicIcon32, ricnLarge
Thank you very much
btw if i want to see the small one, i use bellow code :
That right jx??
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
RetrieveIcon "C:\Program Files\Winamp\winamp.exe", PicIcon32, ricnSmall
you're Welcome...
Happy coding Friend
Happy coding Friend
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Similar Threads
- Network cable is un-plugged! No it isn't. (Networking Hardware Configuration)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Need Help Creating A Macro
- Next Thread: VB app that opens two CSV file
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






