Solved

printing an HICON

Posted on 2004-10-13
4
446 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

770 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