添加消息映射void OnLButtonDown(UINT nFlags, CPoint point) ;
在消息响应函数中添加如下代码:
CString str;
str.Format(_T("%d,%d"),point.x,point.y);
AfxMessageBox(_T("鼠标点击的坐标是:"+str);
//Helloworld!
#include
int WINAPI(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow)
{
MessageBox(NULL,TEXT("Hello world!"),TEXT("HelloMsg"),0);
return 0;
}
自己包含头文件,链接相应的lib,具体请查看MSDN的相关函数说明。