#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    22
    Rep Power
    0

    Question concerning visual c++ 6.0


    I have been messing around with visual c++ 6.0 and I was wondering how I can store what a user puts in an input box into a variable. Later when the user hits like maybe add(if its a calculator) a message box will be displayed with the sum of the two numbers the user inputed. I have Sams Teach yourself Visual C++ 6.0 but I haven't found in the book how to do this. Thanks for all help and advice provided.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    something like (MFC):
    char *str=myCWnd->EditField1->GetText();
    or for API programming:
    char *str=SendMessage(InputForm->EditField1->Handle, WM_GETTEXT, 0, 0);

    i am not sure about the syntax as i am not doing any GUI windows programming in C/C++, but shouldn´t this be trivial...?
  4. #3
  5. No Profile Picture
    Offensive Member
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2002
    Location
    in the perfect world
    Posts
    622
    Rep Power
    27
    >>I was wondering how I can store what a user puts in an input box into a variable

    Process the WM_COMMAND msg for the control

    Different type of control have different msg's.

    Code:
    case WM_COMMAND:
          	idControl = GET_WM_COMMAND_ID( wParam, lParam) ;
             switch(idControl)
             {
                       case ID_INPUT_BOX:   
                       //is a button
    		   if(BN_CLICKED == HIWORD(wParam))
                       //is an edit
                       if (EN_CHANGE == HIWORD(wParam))
    The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

    Frank Zappa

IMN logo majestic logo threadwatch logo seochat tools logo