Archived

This topic is now archived and is closed to further replies.

How do I print a loaded .bmp to the printer?

This topic is 5241 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a CBmp object which loads bitmap pixel data into a BYTE buffer. I want to be able to send that data to the printer. As far as I understand, I need to get ahold of a PrinterDC and "draw" the data to that DC. The problem is that I''m not sure how to actually get a printer DC, nor how to send pixel data to it. My game is written using DirectX 8 without MFC. I have already figured out how to take data from the rendering buffer and save it into a CBmp object. I just need to figure out how to send that data to the printer. Anyone have any suggestions? Thanks in advance!

Share this post


Link to post
Share on other sites
http://msdn.microsoft.com/library/en-us/gdi/prntspol_62ia.asp

Trying looking there, although it may mean you have to create a compatible DC for the bitmap. If you want a better explanation, or are unsure about anything there, just ask

Share this post


Link to post
Share on other sites
Hey, thanks for posting that link--it was pretty helpful.

I need to use CreateDC to get a printer device context. the CreateDC function takes four parameters:

LPCTSTR lpszDriver //I can set this to NULL in WinXP (my target OS)
LPCTSTR lpszDevice //Need the name of the output device used
LPCTSTR lpszOutput //Must be NULL
DEVMODE *lpInitData //pointer to DEVMODE structure containing device-specific initialization code

Here is my question:

I need to be able to grab the name of the printer device (as it would display in the print manager) on my users'' machines. Does anyone know how to do this?

Share this post


Link to post
Share on other sites