Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

printing an HICON

Posted on 2004-10-13
4
Medium Priority
?
485 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
[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
4 Comments
 
LVL 13

Accepted Solution

by:
SteH earned 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

609 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