Ok, i have 2 edit controls and a button in my main window; in one edit control the user can write a number and when he push the button i read that number and i print it in the other edit control (which is read only).
My problem is that when i put a number and i press the button, for some reason that i dont understand i can get that number. And GetDlgItemInt() always return zero and his third parameter always return me false.
This is the code where i use GetDlgItemInt () to read the number:
case CM_BUTTON:
number = GetDlgItemInt(hwndEdit2, CM_EDIT2, &flag, FALSE);
if(flag)
{
if(number > 0 && number < 20)
{
sprintf(message, "This is the number %d", number);
SetWindowText(hwndEdit, message);
}
else
MessageBox(hwnd, "Number to high or to low", "Error", MB_OK | MB_ICONWARNING);
}
else
MessageBox(hwnd, "Error getting the number", "Error", MB_ICONEXCLAMATION | MB_OK);
break;
Any suggest?