Writing graphics to a Device context
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Writing graphics to a Device context

  1. #1
    Join Date
    May 2005
    Posts
    399

    Writing graphics to a Printer Device context

    Hi all,

    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:
    BitBlt(hdcPrn,0,0,1024,768,hdcScreen,0,0,SRCCOPY)
    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.

    Thanks
    Last edited by leojose; May 12th, 2005 at 11:10 PM. Reason: changed title

  2. #2
    Join Date
    May 2005
    Posts
    4,951

    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:

    Applcation appWord;
    appWord.CreateDispatch("Wo*rd.Application");
    appWord.Open ( ...) //give the file name to open + other parameters
    appWord.PrintOut( ...) // print the opened file
    appWord.ReleaseDispach();

    basically thats all you have to do.

    if you got problem let me know.

    Cheers
    Shahar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center