Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Print a long CString

Print a long CString

Scheduled Pinned Locked Moved C / C++ / MFC
c++questioncareer
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gagnon Claude
    wrote on last edited by
    #1

    Hi, I have a C++ program with MFC. I utilize the OnPrint() mechanism to print a Cstring line by line with pDC->TextOut(). That is working the first time I print. If I repeat the print job, the page is blank. I don't understand why. Here is a portion of OnPrint(): CString resToken; I print the Cstring one line at a time. pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken); Does it have a better way to do the printing? Why the page is blank the second time? Do I have to reset something? Thanks,

    enhzflepE L 2 Replies Last reply
    0
    • G Gagnon Claude

      Hi, I have a C++ program with MFC. I utilize the OnPrint() mechanism to print a Cstring line by line with pDC->TextOut(). That is working the first time I print. If I repeat the print job, the page is blank. I don't understand why. Here is a portion of OnPrint(): CString resToken; I print the Cstring one line at a time. pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken); Does it have a better way to do the printing? Why the page is blank the second time? Do I have to reset something? Thanks,

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #2

      From things you've said, I think you're talking about printing on paper instead of a screen. There is indeed a process to follow when doing so, it involves telling the print sub-system that you've printed a page and wish to print another in the same print-job. If indeed producing a hard-copy output is your aim, you may find the following of some use: Answer --> I want to print an image from a class library project without any gui.[^] You can and should enumerate the available printers in your system and allow the user to choose from them. In this example, I've simply used the printer's name, as seen in Control Panel\Hardware and Sound\Devices and Printers in Win7.

      "When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon

      1 Reply Last reply
      0
      • G Gagnon Claude

        Hi, I have a C++ program with MFC. I utilize the OnPrint() mechanism to print a Cstring line by line with pDC->TextOut(). That is working the first time I print. If I repeat the print job, the page is blank. I don't understand why. Here is a portion of OnPrint(): CString resToken; I print the Cstring one line at a time. pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken); Does it have a better way to do the printing? Why the page is blank the second time? Do I have to reset something? Thanks,

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Gagnon Claude wrote:

        pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken);

        That does not really tell us anything useful. You need to show where in your code you check for end of page, and exactly what index values you start with on the second page.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups