Display File associated ICON

  • Thread starter Thread starter ALESSANDRO Baraldi
  • Start date Start date
A

ALESSANDRO Baraldi

Hi all.
Can i display on my Form the File's associated ICON ...?

I Have single view Form each Record have a Path of my File
and i need to display the associated ICON.

Thanks.
 
You can use win32 API SHGetFileInfo to "Retrieve the handle to the icon that
represents the file and the index of the icon within the system image list".
I guess the icon data comes back as a structure, & the "index within the
system image list" could be used to index into the system image list -
whatever that is!

Having got that info, I'm not sure how you could display the icon on your
form. Certainly not in an unbound control (if it is a continuous form).

Maybe you could get the filenames, extract the icons (using SHGetFileInfo or
whatever), then store the names & icon data in a db table? Then display the
content of that table, with the icon data in an image control?

HTH,
TC
 
TC said:
You can use win32 API SHGetFileInfo to "Retrieve the handle to the icon that
represents the file and the index of the icon within the system image list".
I guess the icon data comes back as a structure, & the "index within the
system image list" could be used to index into the system image list -
whatever that is!

In Vb no probleme using PictureBox, but i don't use Image_list, i have
not ODE licens, so nothing about OCX.....!
Having got that info, I'm not sure how you could display the icon on your
form. Certainly not in an unbound control (if it is a continuous form).

OK, thanks it' normal, my FORM it's Single Record....!
Maybe you could get the filenames, extract the icons (using SHGetFileInfo or
whatever), then store the names & icon data in a db table? Then display the
content of that table, with the icon data in an image control?

YES, my problem is how to do it, just use SHGetFileInfo no problem, store
name
in TBL no problem, my problem is HOW Store ICON after using SHGetFileInfo
in OLE Field.....!!!!

Have you some EXEMPLE or ListCode about it....?

Thanks for all.

Alessandro(IT)
 
ALESSANDRO Baraldi said:
In Vb no probleme using PictureBox, but i don't use Image_list, i have
not ODE licens, so nothing about OCX.....!

Er, not sure what you're getting at there? The "system image list" referred
to in the SHGetFileInfo documentation, would be an internal win32 thing. It
would not be anything to do with the VB "image list" control, or OCXs.

OK, thanks it' normal, my FORM it's Single Record....!

Then you could maybe store the icon data in an unbound picture control? I'm
not sure (having never done this myself). But if it was a continuous form,
you could definitely >not< have used an unbound control.

SHGetFileInfo

YES, my problem is how to do it, just use SHGetFileInfo no problem, store
name
in TBL no problem, my problem is HOW Store ICON after using SHGetFileInfo
in OLE Field.....!!!!

Have you some EXEMPLE or ListCode about it....?

No, sorry. I've not done this myself, so I can't suggest any actual code.

Steven Lebans (www.lebans/com) would be the one to answer this. If he
doesn't butt in, perhaps repost your question with his name included in the
subject line?

HTH,
TC
 
TC said:
Er, not sure what you're getting at there? The "system image list" referred
to in the SHGetFileInfo documentation, would be an internal win32 thing. It
would not be anything to do with the VB "image list" control, or OCXs.



Then you could maybe store the icon data in an unbound picture control? I'm
not sure (having never done this myself). But if it was a continuous form,
you could definitely >not< have used an unbound control.



No, sorry. I've not done this myself, so I can't suggest any actual code.

Steven Lebans (www.lebans/com) would be the one to answer this. If he
doesn't butt in, perhaps repost your question with his name included in the
subject line?

HTH,
TC


OK, i resolve the problem with Lebans Help.....!

Thanks for good info....!

Alessandro(IT).
 
Back
Top