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. Printing with a CString

Printing with a CString

Scheduled Pinned Locked Moved C / C++ / MFC
mcptutorialquestion
4 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 print a CString with pDC->TextOut(). That is working. But if I print again, the sheet is blank. How to correct that? Do I have to utilize GetBuffer(), etc? Thanks, Claude

    J L 3 Replies Last reply
    0
    • G Gagnon Claude

      Hi, I print a CString with pDC->TextOut(). That is working. But if I print again, the sheet is blank. How to correct that? Do I have to utilize GetBuffer(), etc? Thanks, Claude

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #2

      Just a guess, could you be overwriting the first print? Do you have a new line character (or carraige return and line feed) at the end?

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst

      1 Reply Last reply
      0
      • G Gagnon Claude

        Hi, I print a CString with pDC->TextOut(). That is working. But if I print again, the sheet is blank. How to correct that? Do I have to utilize GetBuffer(), etc? Thanks, Claude

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

        Print what, where ... ? Please provide some proper context and detail about what your program is doing. [edit] Have you checked http://msdn.microsoft.com/en-us/library/yzabsdzx.aspx[^]? [/edit]

        1 Reply Last reply
        0
        • G Gagnon Claude

          Hi, I print a CString with pDC->TextOut(). That is working. But if I print again, the sheet is blank. How to correct that? Do I have to utilize GetBuffer(), etc? Thanks, Claude

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

          Hi, Your not really 'printing' but rather painting text using GDI if your utilizing the TextOut function[^]. Sounds like the wm_erasebkgnd handler (or conversely WM_PAINT if you are painting in the erase handler)is overwriting what you painted. You should share some code. Also recommend reading all of this: Painting and Drawing[^] Best Wishes, -David Delaune

          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