Programming Microsoft vc++学习(1)
来源:互联网 发布:淘宝联盟社区找淘宝客 编辑:程序博客网 时间:2024/05/12 00:25
The MessageMap
消息映射
When the user presses the left mouse button in a view window, Windows sends a message—specifically WM_LBUTTONDOWN—to that window. If your program needs to take action in responseto WM_LBUTTONDOWN, your view class must have a member function that looks likethis:
void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
{
// event processing code here
}
Your class header filemust also have the corresponding prototype:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
Theafx_msgnotation is a "no-op" that alerts you that this is a prototype for amessage map function. Next, your code file needs a message map macro thatconnects yourOnLButtonDown function to the application framework:
BEGIN_MESSAGE_MAP(CMyView, CView)
ON_WM_LBUTTONDOWN() // entry specifically for OnLButtonDown
// other message map entries
END_MESSAGE_MAP()
Finally, your classheader file needs the statement
DECLARE_MESSAGE_MAP()
You can manually code the message-handling functions—indeed, that is still necessary for certain messages. Fortunately, Visual C++ provides a tool, ClassWizard, that automa tes the coding of most message map functions.
- Programming Microsoft vc++学习(1)
- Programming Microsoft Windows with Csharp. Chapter 1
- VC->学习C/C++ Programming stylse guideness
- Programming Microsoft .NET
- Programming Microsoft Windows CE
- Programming Microsoft Web Forms
- Programming Microsoft Dynamics NAV
- Core Python Programming学习记录(1)
- 学习linux programming(1)
- 学习vc++(1)
- VC++ 学习(1)
- Programming Microsoft Windows Ce .Net, Third Edition(内置源码)
- Microsoft SilverLight 学习教程(1)
- Microsoft SilverLight 学习教程(1)
- Microsoft windows internals 学习笔记(1)
- Network Programming for Microsoft Windows
- Applied Microsoft .NET Framework Programming
- VC++学习笔记(1)
- 视频网站盈利模式与营销策划
- Google Adsence 和 Google AdWords 的区别
- C#中byte[]与string的转换
- 扩展方法,Objective-C
- C++中多态的实现原理
- Programming Microsoft vc++学习(1)
- Joomla 组件开发 常见问题
- ant自动编译发布Java项目
- P2P-挑战和机遇
- segV caused by sizeof
- c#当前应用程序路径
- NDK 之 注意事项
- 内联函数
- 定制centos6.0