About the WM_ENABLE?
-
To make the control of IDC_RADIO1 to be enabled state,I tried
SendDlgItemMessage
andEnableWindow
respectively.The result is the statement "EnableWindow(GetDlgItem(hDlg,IDC_RADIO1),TRUE);
" succeeds, but the "SendDlgItemMessage( hDlg, IDC_RADIO1, WM_ENABLE, (WPARAM)0L, (LPARAM)0L );
" is failing! Why??? The following is my codes:// Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: case IDCANCEL: EndDialog(hDlg, LOWORD(wParam)); return TRUE; case IDC_BUTTON1: //SendDlgItemMessage( hDlg, IDC_RADIO1, WM_ENABLE, (WPARAM)TRUE, (LPARAM)0L );//fail! EnableWindow(GetDlgItem(hDlg,IDC_RADIO1),TRUE);//succeed. //SendDlgItemMessage( hDlg, (int)IDC_BUTTON2, WM_ENABLE, (WPARAM)0L, (LPARAM)0L );//fail! //SendMessage(GetDlgItem(hDlg,IDC_RADIO1), WM_ENABLE, (WPARAM)0L, (LPARAM)0L );//fail! break; } break; } return FALSE; }
Rap off for you,for me,for our human. -
To make the control of IDC_RADIO1 to be enabled state,I tried
SendDlgItemMessage
andEnableWindow
respectively.The result is the statement "EnableWindow(GetDlgItem(hDlg,IDC_RADIO1),TRUE);
" succeeds, but the "SendDlgItemMessage( hDlg, IDC_RADIO1, WM_ENABLE, (WPARAM)0L, (LPARAM)0L );
" is failing! Why??? The following is my codes:// Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: case IDCANCEL: EndDialog(hDlg, LOWORD(wParam)); return TRUE; case IDC_BUTTON1: //SendDlgItemMessage( hDlg, IDC_RADIO1, WM_ENABLE, (WPARAM)TRUE, (LPARAM)0L );//fail! EnableWindow(GetDlgItem(hDlg,IDC_RADIO1),TRUE);//succeed. //SendDlgItemMessage( hDlg, (int)IDC_BUTTON2, WM_ENABLE, (WPARAM)0L, (LPARAM)0L );//fail! //SendMessage(GetDlgItem(hDlg,IDC_RADIO1), WM_ENABLE, (WPARAM)0L, (LPARAM)0L );//fail! break; } break; } return FALSE; }
Rap off for you,for me,for our human.From msdn: The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. So i think WM_ENABLE is like a notification message and its handler isn't really responsible for changing the state of the control. Weiye Chen When pursuing your dreams, don't forget to enjoy your life...