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. I need to make this more compact.

I need to make this more compact.

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

    I like to write lines of code that are very short and very simple to understand. Is there a way that I can communicate this in a shorter more compact form? CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT); char cinput[255]; idcinput->GetWindowText(cinput, 255); CString sinput = cinput; Thank you, Eric Sepich

    M T A M 4 Replies Last reply
    0
    • E esepich

      I like to write lines of code that are very short and very simple to understand. Is there a way that I can communicate this in a shorter more compact form? CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT); char cinput[255]; idcinput->GetWindowText(cinput, 255); CString sinput = cinput; Thank you, Eric Sepich

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      don't use C string when using MFC. replace with

      CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT);
      CString sinput;
      idcinput->GetWindowText(sinput );


      Maximilien Lincourt "Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )

      1 Reply Last reply
      0
      • E esepich

        I like to write lines of code that are very short and very simple to understand. Is there a way that I can communicate this in a shorter more compact form? CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT); char cinput[255]; idcinput->GetWindowText(cinput, 255); CString sinput = cinput; Thank you, Eric Sepich

        T Offline
        T Offline
        Terry ONolley
        wrote on last edited by
        #3

        esepich wrote: I like to write lines of code that are very short and very simple to understand If you made the edit control a member variable, then your code could be accomplished with: CString sinput; m_EditCtrl.GetWindowText(&sinput);



        1 Reply Last reply
        0
        • E esepich

          I like to write lines of code that are very short and very simple to understand. Is there a way that I can communicate this in a shorter more compact form? CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT); char cinput[255]; idcinput->GetWindowText(cinput, 255); CString sinput = cinput; Thank you, Eric Sepich

          A Offline
          A Offline
          Anthony_Yio
          wrote on last edited by
          #4

          Or declare a CString member variable of the IDC_INPUT in ClassWizard and call UpdateData(TRUE); m_strYourdata; //your data already being updated and m_strYourdata is ready to be used. Sonork 100.41263:Anthony_Yio

          1 Reply Last reply
          0
          • E esepich

            I like to write lines of code that are very short and very simple to understand. Is there a way that I can communicate this in a shorter more compact form? CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT); char cinput[255]; idcinput->GetWindowText(cinput, 255); CString sinput = cinput; Thank you, Eric Sepich

            M Offline
            M Offline
            Mike Dimmick
            wrote on last edited by
            #5

            CString sData;
            GetDlgItemText( IDC_INPUT, sData );

            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