?
Solved

HICON from CBitmap

Posted on 1998-11-15
2
Medium Priority
?
1,204 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 100 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

800 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