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. change mesage box text

change mesage box text

Scheduled Pinned Locked Moved C / C++ / MFC
question
10 Posts 5 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.
  • J Offline
    J Offline
    jqt
    wrote on last edited by
    #1

    hey every one! i was wondering is there any way that i can be able to change the text on a message box? what i mean is, in the funtion MessageBox(NULL,"text1","text2",MB_OK); is there any way that i can change the "text1" depending on what happends in the code? thanx, jt

    W H D 3 Replies Last reply
    0
    • J jqt

      hey every one! i was wondering is there any way that i can be able to change the text on a message box? what i mean is, in the funtion MessageBox(NULL,"text1","text2",MB_OK); is there any way that i can change the "text1" depending on what happends in the code? thanx, jt

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      just pass a pointer to text instead. char *foo = "Hello"; char *bar = "World"; char *txt = foo; MessageBox(NULL,txt,bar,MB_OK); txt = bar; MessageBox(NULL,txt,bar,MB_OK); You can then send in any string you like just by setting up a pointer.

      J 1 Reply Last reply
      0
      • W Waldermort

        just pass a pointer to text instead. char *foo = "Hello"; char *bar = "World"; char *txt = foo; MessageBox(NULL,txt,bar,MB_OK); txt = bar; MessageBox(NULL,txt,bar,MB_OK); You can then send in any string you like just by setting up a pointer.

        J Offline
        J Offline
        jqt
        wrote on last edited by
        #3

        hhhmm.. ya i tryed that it works great! thanx alot now i ave a good basis i can go on. ok quick question what about this piece of code #include #include char *foo; char *fo="yo"; char *txt=foo; int main(){ char input; gets(input); input=foo; MessageBox(NULL,foo,fo,MB_OK); } this dosnt seem to work for me can u shed some light? thanx, jt

        B 1 Reply Last reply
        0
        • J jqt

          hey every one! i was wondering is there any way that i can be able to change the text on a message box? what i mean is, in the funtion MessageBox(NULL,"text1","text2",MB_OK); is there any way that i can change the "text1" depending on what happends in the code? thanx, jt

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          Can you more explain change text on a MessageBox do you need to change text on parameters?


          WhiteSky


          J 1 Reply Last reply
          0
          • H Hamid Taebi

            Can you more explain change text on a MessageBox do you need to change text on parameters?


            WhiteSky


            J Offline
            J Offline
            jqt
            wrote on last edited by
            #5

            yea kinda like that. but i wanna be able to change parameter 2 in the message box. depending on if a certin thing happends or not. ya see?

            H 1 Reply Last reply
            0
            • J jqt

              yea kinda like that. but i wanna be able to change parameter 2 in the message box. depending on if a certin thing happends or not. ya see?

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              Why waldermort answer doesnt work for you


              WhiteSky


              1 Reply Last reply
              0
              • J jqt

                hhhmm.. ya i tryed that it works great! thanx alot now i ave a good basis i can go on. ok quick question what about this piece of code #include #include char *foo; char *fo="yo"; char *txt=foo; int main(){ char input; gets(input); input=foo; MessageBox(NULL,foo,fo,MB_OK); } this dosnt seem to work for me can u shed some light? thanx, jt

                B Offline
                B Offline
                benjymous
                wrote on last edited by
                #7

                the line "input=foo" overwrites the text you input with an undefined string. I think what you meant was "foo=input"

                -- Help me! I'm turning into a grapefruit! Buzzwords!

                D 1 Reply Last reply
                0
                • B benjymous

                  the line "input=foo" overwrites the text you input with an undefined string. I think what you meant was "foo=input"

                  -- Help me! I'm turning into a grapefruit! Buzzwords!

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  benjymous wrote:

                  I think what you meant was "foo=input"

                  foo = &input perhaps.


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  1 Reply Last reply
                  0
                  • J jqt

                    hey every one! i was wondering is there any way that i can be able to change the text on a message box? what i mean is, in the funtion MessageBox(NULL,"text1","text2",MB_OK); is there any way that i can change the "text1" depending on what happends in the code? thanx, jt

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    jqt wrote:

                    is there any way that i can change the "text1" depending on what happends in the code?

                    Yes, just use a variable instead of a string literal.


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    J 1 Reply Last reply
                    0
                    • D David Crow

                      jqt wrote:

                      is there any way that i can change the "text1" depending on what happends in the code?

                      Yes, just use a variable instead of a string literal.


                      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                      "Judge not by the eye but by the heart." - Native American Proverb

                      J Offline
                      J Offline
                      jqt
                      wrote on last edited by
                      #10

                      hhhmmm.. ok i will try that. thanx all for your help! (and time)

                      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