MFC 简单的事件测试

View 的 WM_LBUTTONDOWN 事件消息。
void CMFCApplication1View::OnLButtonDown(UINT nFlags, CPoint point)
{
    CString str;
    str.Format(TEXT("x = %d, y = %d"), point.x, point.y);
    MessageBox(str);
    CView::OnLButtonDown(nFlags, point);
}

View 的 WM_CHAR 事件消息。
void CMFCApplication1View::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    TCHAR ch = (TCHAR)nChar;
    CString str;
    str.Format(TEXT("%c"), ch);
    MessageBox(str);
    CView::OnChar(nChar, nRepCnt, nFlags);
}
 
                    
                 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号