Solved

printing an HICON

Posted on 2004-10-13
4
452 Views
Last Modified: 2011-09-20
For some reason I just can't get my HICON to print.  I can print an image loaded via LoadImage to print via GetDIBits and StretchDIBits but my icon refuses to work.  The code to do this would be a huge help, I have been trying for days.
I have been playing about with
GetIconInfo( iconExtracted, &IconInfo32x32);
GetObject( IconInfo32x32.hbmColor  , sizeof(BITMAP), &Bmp);
I end up with a BITMAP object, all I might need is the code to get the handle of the BITMAP object.
0
Comment
Question by:horrid
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
SteH earned 500 total points
ID: 12306288
The handle used in GetObject is the first parameter. I guess you need to do a bitblt of the icon bitmap into a bitmap created of the correct size for your icon (32x32 pixels).
0
 
LVL 12

Expert Comment

by:OnegaZhang
ID: 12306812
the following may be useful to you
http://www.fruitfruit.com/vc/release/post/print.htm

0
 

Author Comment

by:horrid
ID: 12314079
wow, after 3 days I just replaced the HICON reference witt IconInfo32x32.hbmColor as directed by SteH and bingo..works first go.  The white background area did print as black but I am happy to overlook that.

And thanks OnegaZhung, nice example.  I have bookmarked that one for future use.
0
 
LVL 13

Expert Comment

by:SteH
ID: 12316555
You might be able to use the mask bitmap to get the background to white. Bitblt or MaskBlt the mask to the image to change the background color to white. I am not sure what raster operation you will need. Either do some experiments or post a reduced mask and icon bitmap. In principle this should be done when displaying an icon/cursor as well.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Template syntax for variable length arrays 9 75
How to split this in C++ 4 106
trigs fail! I thought I knew how to do trignometry 3 75
max float value 3 51
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

766 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