Solved

HICON from CBitmap

Posted on 1998-11-15
2
1,152 Views
Last Modified: 2013-12-03
If I have a CBitmap, how do I get/convert it to a HICON.
0
Comment
Question by:jubjub
2 Comments
 

Author Comment

by:jubjub
ID: 1416105
I'll give some more info..  Basically I have a DC where I'm doing some Drawing.  I want to get the Bitmap.  Easy enough.  But then I want to get a HICON.  Handle to the Icon Data.  
There has to be an easy way of doing this...  With the HICON, i can use to do what ever I want, like saving to an ICO file..for example, of drawing to the SysTray..etc  etc  etc
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 50 total points
ID: 1416106
Declare a CImageList

use Create member to add create the image list empty

use Add member to add CBitmap to the image list

use ExtractIcon member to obtain an image of the n'th item in the image list


BTW
1. You can get the size req'd for an icon using ::GetSystemMetrics( SM_CXICON or SM_CYICON)

2. If the original bitmap is the wrong size, create a 2 nd memory bitmap with is the correct size and StretchBlt from the first to the second, and Add the 2nd memory bitmap to the image list

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now