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. problem with api messagebox

problem with api messagebox

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelpjson
4 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
    a1_shay
    wrote on last edited by
    #1

    i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?

    L S _ 3 Replies Last reply
    0
    • A a1_shay

      i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?

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

      You can only pass a single string to the MessageBox() function. Use sprintf() or the appropriate variant to create a single character array containing your complete message.

      Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

      1 Reply Last reply
      0
      • A a1_shay

        i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?

        S Offline
        S Offline
        Satheesh1546
        wrote on last edited by
        #3

        Hi, The problem is with your conversion.. Cheers

        1 Reply Last reply
        0
        • A a1_shay

          i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          You need to concatenate the strings first before you call MessageBox. As Richard said, you can use sprintf to do this. If you have wide character strings, you must use the swprintf function instead. You could also use the _stprintf (or _stprintf_s) macro which would cater for both sprintf (sprintf_s) or swprintf (swprintf_s) depending on whether UNICODE is defined. You can also use the _tcscat (or _tcscat_s) macro to do this. Other options are to use the CString += operator or the std::wstring += operator.

          «_Superman_»  _I love work. It gives me something to do between weekends.

          _Microsoft MVP (Visual C++)

          Polymorphism in C

          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