May 11th, 2005, 05:41 AM
Writing graphics to a Printer Device context
My aim is to get the handle of a printer and then pass some data to it for printing. so far I have managed to get the handle of printer:
hdcPrn = GetPrinterDC()
and then just for testing i captured the desktop screen but getting the handle of the screen and copied this data to the printer using BitBlt:
where hdcScreen is the Device Context of the screen.
Now what i want to do is read some data from a word document using Creatfile() and ReadFile() and then write whatever data I get into the Device DC of the printer. I am sure Writefile() or TextOut() will not work b'coz the .doc might contain images also. I want to know if there is any command or method to write a buffer data into a device DC.
Last edited by leojose; May 12th, 2005 at 11:10 PM.
Reason: changed title
May 24th, 2005, 03:17 AM
Re: Writing graphics to a Device context
there is much easier way to do what you asking.
all you have to do is use Word Automation, and simply by couple of commands you open a doc file and can priniting it, without any pharsing of the document i did it once with Excel!
the code should look somehting like that:
appWord.Open ( ...) //give the file name to open + other parameters
appWord.PrintOut( ...) // print the opened file
basically thats all you have to do.
if you got problem let me know.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!