Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / August 2004

Tip: Looking for answers? Try searching our database.

Add icons to ListView with Leban's clsPictureBox ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ruggero - 19 Aug 2004 10:37 GMT
I am extracting icons from an application's path name using the ExtractIcon
function from shell32.dll

I am using Stephan Leban's clsPictureBox (thank you) to draw the icon onto
an MSAccess
image control Image0.

I cannot then add that image to the ListImages object.

The following works with the LoadPicture (icon path name):

Dim imgX As ListImage
Set imgX = ImageList1.ListImages. _
Add(, , LoadPicture("icons\mail\mail01a.ico"))

It does not work with:

Set x = ImageList1.ListImages. _
Add(, "key1", Me!Image0)

It gives error 481 Invalid Picture

Any help much appreciated.
Stephen Lebans - 20 Aug 2004 23:53 GMT
Why do you not simply assign the Icon handle returned by your call to
ExtractIcon directly to the Add method of your ImageList control?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> I am extracting icons from an application's path name using the ExtractIcon
> function from shell32.dll
[quoted text clipped - 19 lines]
>
> Any help much appreciated.
Ruggero - 23 Aug 2004 06:38 GMT
Thank you for your reply.

I tried assigning the icon hanlde directly but get an error 13 'Type
mismatch'.

The code I used was:

hInst = GetWindowLong(Application.hWndAccessApp, GWL_HINSTANCE)

str = "c:\program files\microsoft office\office\excel.exe"

hIcon = ExtractIcon(hInst, str, CLng(0))

Set x = ctlImg.ListImages.Add(, "excel", hIcon)

Apologies if I am being a bit slow here...

The above is in Access97 vba.

> Why do you not simply assign the Icon handle returned by your call to
> ExtractIcon directly to the Add method of your ImageList control?
[quoted text clipped - 32 lines]
> >
> > Any help much appreciated.
Stephen Lebans - 24 Aug 2004 00:43 GMT
Can you send me your MDB so I can have a look at it. It would be a lot
easier than me trying to recreate your issue from scratch.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> Thank you for your reply.
>
[quoted text clipped - 51 lines]
> > >
> > > Any help much appreciated.
Stephen Lebans - 25 Aug 2004 00:52 GMT
I've modified your code to work. Over in VB land there was code to
convert a handle to an Icon to a StdPicture object which is the format
used by the ImageList control. Modified code was emailed to you tonight.
:-)
Good luck.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> Can you send me your MDB so I can have a look at it. It would be a lot
> easier than me trying to recreate your issue from scratch.
[quoted text clipped - 67 lines]
> > > >
> > > > Any help much appreciated.
Ruggero - 25 Aug 2004 07:45 GMT
Perfect.

Thank you for all all your help.

> I've modified your code to work. Over in VB land there was code to
> convert a handle to an Icon to a StdPicture object which is the format
[quoted text clipped - 81 lines]
> > > > >
> > > > > Any help much appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.