首先Dialog在把聚焦到按钮或者其他空间上,例如你得Dialog聚焦在Button上,他就会屏蔽你得WM_CHAR和WM_KEYDOWN消息,这时候下断点就不会进入到WM_CHAR消息中.
通过函数SetWindowLong();来完成. 下面是源码
BOOL CALLBACK DialogProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_COMMAND:
{
WORD uID=LOWORD(wParam);
switch(uID)
{
case IDOK:
{
TCHAR szChar[256]={0};
HWND hEdt=GetDlgItem(hwndDlg,IDC_EDIT1);
GetWindowText(hEdt,szChar,256);
// MessageBoxW(hwndDlg,_wcsupr(szChar),NULL,MB_OK);
SetWindowText(hEdt,_tcsupr(szChar));
}
break;
case IDCANCEL:
SendMessage(hwndDlg,WM_CLOSE,0,0);
break;
case IDM_FILE_OPEN:
// Messa