同题

解决方案 »

  1.   

    高手看看如下的代码有什么问题吗?为什么出现这种怪问题。
    我对windows编程不熟悉,谢谢各位了   switch (msg)
      {
    case WM_CREATE:
      break; case WM_ACTIVATE:
      
      if (WA_CLICKACTIVE == LOWORD(wParam))
    m_pGuiPaper->PaintWin();
      
      lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
      break; case WM_MEASUREITEM:
      // Get setup for painting text in this window. For later evolution.
      {

      } case WM_SIZE:
      // Handle a resize of this window.
      width = LOWORD(lParam);
      height = HIWORD(lParam);
      // Inform CGuiPaper of the change.
      m_pGuiPaper->Resize(width, height);
      break; case WM_PAINT:
      // If something major happened repaint the whole window.
      {
    PAINTSTRUCT ps; if(BeginPaint(hwnd, &ps))
    {
      m_pGuiPaper->PaintWin();
      EndPaint(hwnd, &ps);
    }
      }
      break; case WM_LBUTTONDOWN:
      // Start sequence of ink drawing to the paper.
      m_pGuiPaper->InkStart(LOWORD(lParam), HIWORD(lParam));
      break; case WM_MOUSEMOVE:
      // Draw inking sequence data.
      m_pGuiPaper->InkDraw(LOWORD(lParam), HIWORD(lParam));
      break; case WM_LBUTTONUP:
      // Stop an ink drawing sequence.
      m_pGuiPaper->InkStop(LOWORD(lParam), HIWORD(lParam));
      break; case WM_COMMAND:
      // Dispatch and handle any Menu command messages received.
      //lResult = DoMenu(wParam, lParam);
      break; case WM_CHAR:
      if (wParam == 0x1b)
      {
    // Exit this app if user hits ESC key.
    ::PostMessage(hwnd, WM_CLOSE, 0, 0);
      }
      break; case WM_CLOSE:
      // The user selected Close on the main window's System menu
      // or Exit on the File menu.
      // If there is ink data that has not been saved then ask user
      // if it should be saved. If user cancels then cancel the exit.
      //if (IDCANCEL == m_pGuiPaper->AskSave())
    //break;
    case WM_QUIT:
      // If the app is being quit then close any associated help windows.
    default:
      // Defer all messages NOT handled above to the Default Window Proc.
      lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
      break;
      }   return(lResult);
      //return ::DefWindowProc(hwnd, msg, wParam, lParam);