MFC里面的一些SDK

下面这个函数作用是读取键盘输入的按键是什么,例如:输入“x”,屏幕会弹出消息对话框“x”

void CMy01MFCtestView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值

TCHAR ch = (TCHAR)nChar;
CString str;
str.Format(TEXT("%c"), ch);
MessageBox(str);


CView::OnChar(nChar, nRepCnt, nFlags);
}

这个是当鼠标左键在窗口点击的时候,会弹出消息对话框显示鼠标左键点击的窗口的坐标值。


void CMy01MFCtestView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值

CString str;
str.Format(TEXT("x=%d,y=%d"), point.x, point.y);

MessageBox(str);

CView::OnLButtonDown(nFlags, point);
}

猜你喜欢

转载自www.cnblogs.com/jianmoxiansheng-Guo/p/11314518.html