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. help me please.

help me please.

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelptutorialquestion
6 Posts 4 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.
  • A Offline
    A Offline
    Angel Kid
    wrote on last edited by
    #1

    I want to know if there is any function like C function 'printf'. For example, I just want to draw a line of text in the view like that:you have typed a %s. in C ,I would do like that :printf("you have typed %s",str); but I could not the function can do like this way(I know there is a function ,TRACE,but it is not I need) in MFC,could anybody answer me? YES, I am here.

    A L 2 Replies Last reply
    0
    • A Angel Kid

      I want to know if there is any function like C function 'printf'. For example, I just want to draw a line of text in the view like that:you have typed a %s. in C ,I would do like that :printf("you have typed %s",str); but I could not the function can do like this way(I know there is a function ,TRACE,but it is not I need) in MFC,could anybody answer me? YES, I am here.

      A Offline
      A Offline
      Anders Molin
      wrote on last edited by
      #2

      CString::Format(); - Anders Money talks, but all mine ever says is "Goodbye!"

      1 Reply Last reply
      0
      • A Angel Kid

        I want to know if there is any function like C function 'printf'. For example, I just want to draw a line of text in the view like that:you have typed a %s. in C ,I would do like that :printf("you have typed %s",str); but I could not the function can do like this way(I know there is a function ,TRACE,but it is not I need) in MFC,could anybody answer me? YES, I am here.

        L Offline
        L Offline
        l a u r e n
        wrote on last edited by
        #3

        CString.Format(wada wada wada) or sprintf(wada wada wada) then TextOut(blah blah blah) then apparently you will have an uncle called bob :cool:


        situations to avoid #37:
        "good morning ... how many sugars do you take in your coffee ... and what was your name again?"

        coming soon: situations to avoid #38: "...and the dog was there too?"

        A 1 Reply Last reply
        0
        • L l a u r e n

          CString.Format(wada wada wada) or sprintf(wada wada wada) then TextOut(blah blah blah) then apparently you will have an uncle called bob :cool:


          situations to avoid #37:
          "good morning ... how many sugars do you take in your coffee ... and what was your name again?"

          coming soon: situations to avoid #38: "...and the dog was there too?"

          A Offline
          A Offline
          Angel Kid
          wrote on last edited by
          #4

          Can these functions write to the view? YES, I am here.

          P L 2 Replies Last reply
          0
          • A Angel Kid

            Can these functions write to the view? YES, I am here.

            P Offline
            P Offline
            Paul M Watt
            wrote on last edited by
            #5

            The first two that Lauren mentioned will format the data in your string into another buffer, then you can use TextOut to draw to your view. You should place the call to TextOut in your OnDraw handler if you are using MFC, or in your handler for WM_PAINT if you are using regular window 32.


            Build a man a fire, and he will be warm for a day
            Light a man on fire, and he will be warm for the rest of his life!

            1 Reply Last reply
            0
            • A Angel Kid

              Can these functions write to the view? YES, I am here.

              L Offline
              L Offline
              l a u r e n
              wrote on last edited by
              #6

              you would normally either let your user type directly into the view (like a text editor) or enter stuff thru a dialog box then in your OnPaint() handler you would put the other code :cool:


              situations to avoid #37:
              "good morning ... how many sugars do you take in your coffee ... and what was your name again?"

              coming soon: situations to avoid #38: "...and the dog was there too?"

              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