|
-
May 4th, 2002, 01:46 AM
#1
Thread Starter
Hyperactive Member
extract icons to flexgrid
I'm using the following API to pull icons from dll's and put them in a flexgrid. I want to insert the item into a cell in the flexgrid, and thought some db experts might have encountered this before. Any ideas?
Thanks.
Private Type SHFILEINFO
hIcon As Long
iIcon As Long
dwAttributes As Long
szDisplayName As String * 260
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&, ByVal i&, ByVal hDCDest&, ByVal x&, ByVal y&, ByVal flags&) As Long
Private Sub Form_Load()
Dim m As Long, ShInfo As SHFILEINFO
m = SHGetFileInfo("C:\aim\aim.exe", 0&, ShInfo, Len(ShInfo), &H4000 Or &H1)
If m <> 0 Then
Picture1.AutoRedraw = True
Call ImageList_Draw(m, ShInfo.iIcon, Picture1.hdc, 0, 0, &H1)
End If
End Sub
-
May 4th, 2002, 02:52 AM
#2
Frenzied Member
To insert a picture into a flexgrid cell:
VB Code:
With MSHFlaxGrid1
.Row = 1
.Col = 1
Set .CellPicture = LoadPicture(picturefile)
End With
You can also set the .CellPicture property using LoadResPicture to setting to an imagelist
-
May 5th, 2002, 03:25 PM
#3
Hyperactive Member
hello,
other than using John's method, you might have to subclass the Flexgrid and provide your own paint routine. For an exellent tutroial on subclassing, which also has an example of subclassing a flexgrid, go to
ELITEVB.COM
good luck.
For excellent Winsock example check here WINSOCK
-
May 5th, 2002, 05:46 PM
#4
Probably the easiest solution is to use those API calls to put the image into an invisible picturebox and then load it from there into the flexgrid. Once it's loaded into the flexgrid you can keep reusing the same picture.
-
May 6th, 2002, 11:05 AM
#5
Thread Starter
Hyperactive Member
Thanks for the input. I'll play around with it and see what I can come up with.
FLL
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
|