Solved

HICON from CBitmap

Posted on 1998-11-15
2
1,190 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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 this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

687 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