#### Archived

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

# Using GetDlgItemInt... I guess not really game related.

## Recommended Posts

JSCFaith    122
I am making a game, and now I am trying to make a little setup program you can run before it, I just have one simple question. I am trying to get an int from an edit box in windows. I know that you are supposed to use the GetDlgItemInt() funtion, but I can''t understand how you would use that funtion to store a value in an "int." If anyone could help me that would be great. Thanks Later, James

##### Share on other sites
Zipster    2365
make the dialog box a resource, and assign tags to each window (IDOK is standard for the OK button, IDCANCEL for the cancel button). Then, in your application defined dialog box procedure, process the WM_COMMAND message.

LOWORD(wParam) is the control ID (IDOK, IDCANCEL, etc.)
(HWND)lParam is a handle to the control.

Just read up in MSDN on anything i left out.

##### Share on other sites
WhoopA    122
Let''s say you had a field marked IDI_NUMBER that has an unsigned (always positive) value. You would call it like this:

  BOOL CALLBACK DlgProc (HWND window, UINT msg, WPARAM wp, LPARAM lp){ int number;...number = GetDlgItemInt(window,IDI_NUMBER,NULL,FALSE);

You''d need to have everything created already. You do know how to do that, right? I have actual samples if you need help.

WhoopA, the Official Kicker of Butts

--- With all its sham, drudgery and broken dreams, it is still a beautiful world. Be careful. Strive to be happy.
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.