[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • Last Modified:

printing an HICON

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
horrid
Asked:
horrid
  • 2
1 Solution
 
SteHCommented:
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
 
OnegaZhangCommented:
the following may be useful to you
http://www.fruitfruit.com/vc/release/post/print.htm

0
 
horridAuthor Commented:
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
 
SteHCommented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now