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. MessageBox()

MessageBox()

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
13 Posts 8 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 gentleguy

    dear all i want to display number what i calculated, my code is the folowing: char buff[100]; MessageBox(buff,'number%d'); but compiler showed error: error C2015: too many characters in constant. so what happened? thanks a lot

    gentleguy

    J Offline
    J Offline
    Jagdish V Bhimbha
    wrote on last edited by
    #4

    Hi, You may use like this also :

    int num;
    CString op;
    op.Format("Number : %d",num);
    AfxMessageBox(op);
    // or
    ::MessageBox(0,op,"Title",0);

    Have Good Luck.. :) :rose:

    Jagdish Bhimbha S/W Developer

    T 1 Reply Last reply
    0
    • G gentleguy

      dear all i want to display number what i calculated, my code is the folowing: char buff[100]; MessageBox(buff,'number%d'); but compiler showed error: error C2015: too many characters in constant. so what happened? thanks a lot

      gentleguy

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

      For your strings you must be use of _T(" ") not ' '

      T 1 Reply Last reply
      0
      • H Hamid Taebi

        For your strings you must be use of _T(" ") not ' '

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #6

        Hamid. wrote:

        _T(" ") not ' '

        Might be he want to convert character instead of string .... ;P

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
        Never mind - my own stupidity is the source of every "problem" - Mixture

        cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

        H 1 Reply Last reply
        0
        • J Jagdish V Bhimbha

          Hi, You may use like this also :

          int num;
          CString op;
          op.Format("Number : %d",num);
          AfxMessageBox(op);
          // or
          ::MessageBox(0,op,"Title",0);

          Have Good Luck.. :) :rose:

          Jagdish Bhimbha S/W Developer

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #7

          who voted you down?? let me square it!

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
          Never mind - my own stupidity is the source of every "problem" - Mixture

          cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

          1 Reply Last reply
          0
          • S Sarath C

            are you trying to do something like this?

            char buff[100];
            sprintf( buff, "number %d", number );
            MessageBox( buff );

            -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

            My blog - Sharing My Thoughts, An Article - Understanding Statepattern

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #8

            Sarath. wrote:

            char buff[100];

            After working in painstaking conversion of MBCS code to UNICODE. Now, i prefer TCHAR instead of char

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
            Never mind - my own stupidity is the source of every "problem" - Mixture

            cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

            1 Reply Last reply
            0
            • G gentleguy

              dear all i want to display number what i calculated, my code is the folowing: char buff[100]; MessageBox(buff,'number%d'); but compiler showed error: error C2015: too many characters in constant. so what happened? thanks a lot

              gentleguy

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #9

              Good C tutorial needed. Hint: string literals must be enclosed by double quotes. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

              In testa che avete, signor di Ceprano?

              T 1 Reply Last reply
              0
              • T ThatsAlok

                Hamid. wrote:

                _T(" ") not ' '

                Might be he want to convert character instead of string .... ;P

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                Never mind - my own stupidity is the source of every "problem" - Mixture

                cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

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

                So I must be modify my reply. ;)

                T 1 Reply Last reply
                0
                • H Hamid Taebi

                  So I must be modify my reply. ;)

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #11

                  No it will work :) don't worry!

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                  Never mind - my own stupidity is the source of every "problem" - Mixture

                  cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

                  1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    Good C tutorial needed. Hint: string literals must be enclosed by double quotes. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #12

                    CPallini wrote:

                    Good C tutorial needed. Hint: string literals must be enclosed by double quotes.

                    :) would refer him/her for good C book :)

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                    Never mind - my own stupidity is the source of every "problem" - Mixture

                    cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

                    1 Reply Last reply
                    0
                    • G gentleguy

                      dear all i want to display number what i calculated, my code is the folowing: char buff[100]; MessageBox(buff,'number%d'); but compiler showed error: error C2015: too many characters in constant. so what happened? thanks a lot

                      gentleguy

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

                      gentleguy wrote:

                      MessageBox(buff,'number%d');

                      What in the world is this? :confused: The documentation plainly shows that MessageBox() expects four arguments.

                      "Love people and use things, not love things and use people." - Unknown

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      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