Solved

HICON from CBitmap

Posted on 1998-11-15
2
1,183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get a List of Executing Stored Procedures on Sql Server 2008 R2 5 71
Clean Uninstall of VS Professional 2015 5 63
Windows Process running 3 66
Need more details 5 192
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and 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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

732 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