does anyone know how to get the value from an edit box?

Started by
4 comments, last by Mister Stewart 22 years, 7 months ago
okay, suppose you create an edit box as a child window: (CreateWindowEx(NULL, "edit", "0 ", WS_CHILD | WS_VISIBLE | ES_LEFT, 80, 40, 40, 20, hwnd, (HMENU)NOP_ID, hinstance, NULL)) how do you get the value from such a edit box, and save it into a variable? Thanks. "I do not have to destroy, because I do not fear." Edited by - Mister Stewart on September 20, 2001 5:31:38 PM
"16 days?? that's almost two weeks!!" Tucker
Advertisement
It should be something like this :

  const int BUFF_SIZE = 100;char  buffer[BUFF_SIZE+1];HWND edit = GetDlgItem( hwnd, ID_MY_EDIT_ID_NUMBER);GetWindowText( edit, buffer, BUFF_SIZE);int finalValue = atoi(buffer);   


Hope it helps!
thanks guy. I''ll give it a try.



"I do not have to destroy, because I do not fear."
"16 days?? that's almost two weeks!!" Tucker
Thanks again for the reply, but now I need to know how to (drumroll) put values from a variable into an edit box!!

I gather you use the commands SetDlgItemText and SetWindowText, but I am not too sure on how to use these commands.



"I do not have to destroy, because I do not fear."
"16 days?? that's almost two weeks!!" Tucker
Ok man, I''m f*****g drunk but this should work :

  const int BUFF_SIZE = 100;char  buffer[BUFF_SIZE+1];sprintf( buffer, "%d", someValue);HWND edit = GetDlgItem( hwnd, ID_MY_EDIT_ID_NUMBER);SetWindowText( edit, buffer);   


Have fun and don''t drink too much beer, that''s really bad for women...
thanks again for the help.



"I do not have to destroy, because I do not fear."
"16 days?? that's almost two weeks!!" Tucker

This topic is closed to new replies.

Advertisement