|
-
Aug 20th, 2001, 09:22 AM
#1
Thread Starter
Member
File API
I am using a API that lets me scan a folder and add the files in the directory (folder) to a list box. But I want to take this to the next level and add the files to a ListView control, then have windows find the icon that goes with the file, and display it in the listview control along w/ the file. How do I accomplish this????
-
Aug 20th, 2001, 10:44 AM
#2
Yuo could use the ExtractAssociatedIcon API.
-
Aug 20th, 2001, 03:02 PM
#3
Thread Starter
Member
How do I use ExtractAssociatedIcon???
This is what i have been using::::
(in one of my modules)
___________________
Declare Function ExtractAssociatedIconA Lib "shell32.dll" _
( _
ByVal hInst As Long, _
ByVal lpIconPath As String, _
lpiIcon As Long _
) As Long
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 DestroyIcon Lib "user32" _
( _
ByVal hIcon As Long _
) As Long
_______________________________
(IN MY FORM)
_______________________________
Dim icn as long
Dim hInstance as long
Dim Path as string
icn = 0
Path = listview1.selectedItem.Tag
icn = ExtractAssociatedIconA(hInstance, Path, 0)
>>>> DrawIcon <<<< What do I draw it to?
DestroyIcon icn
______________________________
How do I add this to my ListView?????
-
Aug 20th, 2001, 03:57 PM
#4
Try this.
VB Code:
Dim icn as long Dim Path as string
Picture1.AutoRedraw=True
Path = listview1.selectedItem.Tag
icn = ExtractAssociatedIconA(App.hInstance, Path, 0)
If icn Then
DrawIcon Picture1.hDC, 0, 0, icn
Picture1.Picture = Picture1.Image
Set ImageList1.ListImages(index).Picture = Picture1
Set Picture1 = Nothing
DestroyIcon icn
End If
-
Aug 20th, 2001, 03:59 PM
#5
Hmmm..I just tested this out, and the results are somewhat skewed. You might be better of using SHGetFileInfo instead.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|