Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting Edit Box Value

    How do you get the value of an edit box in C++?

  • #2
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Well assuming that you are using the Windows API ( which I think you were off to start learning last time ) there are 2 ( maybe more ) ways..

    Method 1 -- Use GetWindowText() -- I think this works!

    Code:
    int length = GetWindowTextLength( hwnd ) + 1;
    char buffer[ length ];
    GetWindowText( hwnd, buffer, length );
    the variable buffer now contains the text of the window....maybe ..

    Method 2-- The more correct way is to use the EM_GETLINE message--

    Code:
    char *buffer = (char*)SendMessage( hwnd, EM_GETLINE, (WPARAM)1, (LPARAM)0 );
    I'm pretty sure that those methods both work..
    Omnis mico antequam dominus Spookster!

  • #3
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thx again


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •