Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HIcon to ImageList
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00324431
Message ID:
00325290
Views:
28
>Ed & George,
>
>I've been playing with this stuff for the last week or so. I can work out which Icon to load (from the HKCR keys), load an icon with ExtractIcon() which returns an icon handle but (and I think this is the non-trivial step) I can't persist the icon referred to so it can be loaded into an image list.
>
>I've been scouring MSDN, thinking about stuff like creating/obtaining a DC and writing it there, then writing the bitmap to a file and so on, but I can't find the magic savetofile()-type function.
>
>Cheers,
>
Hi Andrew

For the ImageList, the problem is that it wants a picture object. AFAIK, the best we can get from the API, is a handle.

Now, once you've got a handle, you can display it (using DrawIcon()). If you display it, you could use something like my Obj2Bmp to save it to a file. (I'd surround the target area with a shape the same size as the icon 32x32). In order for Obj2Bmp to do what it does, it has to call a number of API functions. The key one (in my case) was BitBlt(). It made the whole project work. So you might want to take a look at that code. It's in the download section under Win32 and other APIs.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform