case VK_RETURN:
hWnd = GetFocus();
Text1 = new TCHAR [10];
Text2 = new TCHAR [10];
         GetWindowText(hWndtext1, Text1, 10);
GetWindowText(hWndtext2, Text2, 10); SetWindowText(hWndtext1,NULL);
SetWindowText(hWndtext2,NULL);
MessageBox(hWnd,Text2, NULL, 0);
break;

解决方案 »

  1.   

    自己Debug下调试一下,进入了case语句了没有?
      

  2.   

    hWnd的窗口是否允许接收回车,如果是对话框而且有OK按纽,那回车消息被OK按纽接收了
      

  3.   

    case WM_KEYDOWN: switch (wParam)
    {
    case VK_UP:
    turtle.Move(true);
    InvalidateRect(hWnd, &clientRect, true);
    break;
    case VK_RIGHT:
    turtle.LeftRight(false);
    InvalidateRect(hWnd, &clientRect, true);
    break;
    case VK_DOWN:
    turtle.Move(false);
    InvalidateRect(hWnd, &clientRect, true);
    break;
    case VK_LEFT:
    turtle.LeftRight(true);
    InvalidateRect(hWnd, &clientRect, true);
    break;
    case VK_F1:
    turtle.Pen();
    InvalidateRect(hWnd, &clientRect, true);
    break;
    case VK_F2:
    turtle.ShowTurtle();
    InvalidateRect(hWnd, &clientRect, true);
    break;
    case VK_F3:
    turtle.reSet();
    InvalidateRect(hWnd, &clientRect, true);
    break;
    case VK_RETURN:
    hWnd  = GetFocus();
    Text1 = new TCHAR [10];
    Text2 = new TCHAR [10];
        GetWindowText(hWndtext1, Text1, 10);
    GetWindowText(hWndtext2, Text2, 10); SetWindowText(hWndtext1,NULL);
    SetWindowText(hWndtext2,NULL); MessageBox(hWnd,Text2, NULL, 0);
    break;
    }
    break;