int EntryFieldMessages(HWND hDlg,WPARAM wParam) {
char buffer[1024];
//Get a handle to the button
HWND hIdOk = GetDlgItem(hDlg,1005);
switch (HIWORD(wParam)) {
case EN_CHANGE:
if (GetDlgItemText(hDlg,1004,
buffer, sizeof(buffer))) {
// There is some text in the entry field. Enable the IDOK button.
EnableWindow(hIdOk,1);
}
else // no text, disable the IDOK button
EnableWindow(hIdOk,0);
break;
}
return 1;
}
in response to WM_COMMAND message, i.e.:
case 1004:
{
switch (HIWORD(wParam)){
case EN_CHANGE:
return EntryFieldMessages(hwnd,wParam);
}
break;
}
1004 represents an edit box identifier, of course.
No comments:
Post a Comment