Archived

This topic is now archived and is closed to further replies.

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

This topic is 6086 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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

Share on other sites
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!

Share on other sites
thanks guy. I''ll give it a try.

"I do not have to destroy, because I do not fear."

Share on other sites
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."

Share on other sites
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...

Share on other sites
thanks again for the help.

"I do not have to destroy, because I do not fear."

• 10
• 19
• 14
• 19
• 15