摘要: A final aspect of Clock that deserves scrutiny is its OnGetMinMaxInfo handler. As a window is being resized, it receives a series of WM_GETMINMAXINFO messages with lParam pointing to a MINMAXINFO structure containing information about the window's minimum and maximum "tracking" sizes. 阅读全文
posted @ 2011-04-02 18:07 好好学习,天天进步 阅读(553) 评论(0) 推荐(0) 编辑
摘要: The difference between a topmost window and a nontopmost window is an extended window style bit. WS_EX_TOPMOST makes a window a topmost window. You can create a topmost frame window by including a WS_EX_TOPMOST flag in the call to Create, like this:Create (NULL, _T ("MyWindow"), WS_OVERLAP 阅读全文
posted @ 2011-04-02 18:04 好好学习,天天进步 阅读(905) 评论(1) 推荐(0) 编辑
摘要: One problem with a window without a title bar is that it can't be repositioned with the mouse. Windows are dragged by their title bars, and when there's no title bar, the user has nothing to grab onto. Clock solves this little dilemma by playing a trick with the window's WM_NCHITTEST han 阅读全文
posted @ 2011-04-02 18:01 好好学习,天天进步 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 1、消息反射解释: 父窗口将控制子窗口发给它的通知消息,首先反射回子窗口进行处理(即给控制子窗口一个机会,让控制子窗口处理此消息),这样通知消息就有机会能被子窗口自身进行处理。2、MFC中引入消息反射的原因: 在Windows的消息处理中,控制子窗口的发给其父窗口的通知消息只能由其父窗口进行处理,这使得控制子窗口的自身能动性大大降低(你想,它连改变自己的背景色,处理一个自身滚动问题都要其父窗口来完成),为了解决这个问题,在MFC中引入了反射消息“Reflect Message”的概念,进行消息反射,可以使得控制子窗口能够自行处理与自身相关的一些消息,增强了封装性,从而提高了控制子窗口的可重.. 阅读全文
posted @ 2011-04-02 17:48 好好学习,天天进步 阅读(633) 评论(1) 推荐(1) 编辑
摘要: As you design your application's menus, you have the option of using keyboard accelerators to assign shortcut keys to any or all of the menu items. An accelerator produces a WM_COMMAND message just as making a menu selection does. Adding keyboard accelerators to your application is simplicity it 阅读全文
posted @ 2011-04-02 17:37 好好学习,天天进步 阅读(521) 评论(0) 推荐(0) 编辑
摘要: // In CMainWindow's message mapON_WM_LBUTTONDOWN ()ON_WM_LBUTTONUP () void CMainWindow::OnLButtonDown (UINT nFlags, CPoint point){ SetCapture ();}void CMainWindow::OnLButtonUp (UINT nFlags, CPoint point){ ::ReleaseCapture ();}In between, CMainWindow receives WM_MOUSEMOVE messages that report ... 阅读全文
posted @ 2011-04-02 17:30 好好学习,天天进步 阅读(391) 评论(0) 推荐(0) 编辑
摘要: It's important to delete the GDI objects you create, but it's equally important to never delete a GDI object while it's selected into a device context. Code that attempts to paint with a deleted object is buggy code. The only reason it doesn't crash is that the Windows GDI is sprinkl 阅读全文
posted @ 2011-04-02 17:11 好好学习,天天进步 阅读(325) 评论(0) 推荐(0) 编辑
摘要: CDC::GetDeviceCapsint GetDeviceCaps(int nIndex) const;返回值:如果成功,则返回所需要的能力值。参数:nIndex 指定返回信息类型,可为下列值之一:· DRIVERVERSION 版本号,例如:0x100表示1.0版· TECHNOLOGY 设备技术,可为下列值之一:值 含义DT_PLOTTER 矢量绘图机DT_RASDISPLAY 光栅显示DT_RASPRINTER 光栅打印机DT_RASCAMERA 光栅照相机DT_CHARSTREAM 字符流DT_METAFILE 元文件DT_DISPFILE 显示文件· 阅读全文
posted @ 2011-04-02 16:54 好好学习,天天进步 阅读(468) 评论(0) 推荐(0) 编辑
摘要: hello.h#include <afxwin.h>class CHelloApp : public CWinApp{ public: virtual BOOL InitInstance();};class CMainWindow : public CFrameWnd{ public: CMainWindow(); protected: afx_msg void OnPaint(); DECLARE_MESSAGE_MAP()};hello.cpp#include "hello.h"CHelloApp myApp;BOOL CHelloApp::InitInst 阅读全文
posted @ 2011-04-02 16:38 好好学习,天天进步 阅读(307) 评论(0) 推荐(0) 编辑