Jump to content
  • Advertisement

Archived

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

Mister Stewart

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

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

If you intended to correct an error in the post then please contact us.

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 this post


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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!