°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
òµÄÖ÷´°¿Ú¾ä±ú£¬·ñÔò·µ»Ø0¡£
Òª·¢Ë͵ÄÊÇÄ£Äâ¼üÅÌ°´¼üµÄÏûÏ¢WM_CHAR£¬ÕâÑù¾ÍºÃÏñÔÚ¼Çʱ¾ÖÐÈ˹¤¼üÈë×Ö·û£¬µ«Ö±½ÓÏò¼Çʱ¾Ö÷´°¿Ú·¢ËÍWM_CHARÏûÏ¢ÊDz»Ðеģ¬ÒªÏò¼Çʱ¾´°¿Ú¿Í»§ÇøÖеıà¼×Ó´°¿Ú·¢ËÍÏûÏ¢²ÅÐУ¬ËùÒÔ³ÌÐòÖÐÓÖÓôÓλÖûñÈ¡×Ó´°¿Ú¾ä±úµÄº¯ÊýChildWindowFromPointÀ´»ñµÃ±à¼×Ó´°¿ÚµÄ¾ä±ú¡£
Ëø¶¨ÁË×îºóµÄÄ¿±ê¼´¼Çʱ¾Öеıà¼×Ó´°¿Úºó£¬³ÌÐòÓÃPostMessageÏòËü·¢ËÍÏûÏ¢£¬¸ù¾Ý×Ö·û´®µÄ³¤¶È£¬ÓÃÒ»¸öÑ»·Ã¿´Î·¢ËÍÒ»¸öWM_CHARÏûÏ¢£¬WM_CHARÏûÏ¢µÄwParamºÍlParamµÄº¬ÒåÊÇ£º
wParam¡¡=¡¡chCharCode¡¡¡¡¡¡¡¡//¡¡wParamÊǼüÖµ
lParam¡¡=¡¡lKeyData¡¡¡¡¡¡¡¡¡¡¡¡//¡¡lParamÊǼüÊý¾Ý£¨Öظ´´ÎÊý£©
³ÌÐòÖÐÓÃmov¡¡eax£»al½«¼üÖµÀ©Õ¹µ½²ÎÊýËùÐèµÄ32룬µ±×öwParam²ÎÊý·¢ËÍ£¬lParamΪ1£¬±íʾ¼üµÄÖظ´´ÎÊýΪ1´Î£¬ÕâÑùÒ»À´£¬¼Çʱ¾ÖоÍÔ´Ô´²»¶ÏµØÏÔʾ³öMsgWindow³ÌÐòµÄÔËÐй켣ÁË¡£
MsgWindow³ÌÐòÔö¼ÓµÄµÚÈý²¿·ÖÊÇÔÚÿ¸öº¯ÊýµÄÇ°ºóÔö¼ÓÁËÏÔʾ״̬µÄÓï¾ä£¬ËüÃÇÖ»ÊǼòµ¥µØ°ÑÒ»¸ö×Ö·û´®·¢Ë͵½¼Çʱ¾ÖÐÈ¥£º
£»¶¨ÒåһЩ×Ö·û´®
szCreateWindow1¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'Creating¡¡Window¡£¡£¡£'£»0dh£»0
szCreateWindow2¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'CreateWindow¡¡end'£»0dh£»0
szShowWindow1¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'Showing¡¡Window¡£¡£¡£'£»0dh£»0
szShowWindow2¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'ShowWindow¡¡end'£»0dh£»0
szUpdateWindow1¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'Updating¡¡Window¡£¡£¡£'£»0dh£»0
szUpdateWindow2¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'UpdateWindow¡¡end'£»0dh£»0
szGetMsg1¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'Getting¡¡Message¡£¡£¡£'£»0dh£»0
szGetMsg2¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'£§£¥04x£§Message¡¡gotten'£»0dh£»0
szDispatchMsg1¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'Dispatching¡¡Message¡£¡£¡£'£»0dh£»0
szDispatchMsg2¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡'DispatchMessage¡¡end'£»0dh£»0
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡_SendtoNotepad£»addr¡¡szCreateWindow1
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡CreateWindowEx£»¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡_SendtoNotepad£»addr¡¡szCreateWindow2
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡_SendtoNotepad£»addr¡¡szShowWindow1
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡ShowWindow£»hWinMain£»SW_SHOWNORMAL
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡_SendtoNotepad£»addr¡¡szShowWindow2
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡_SendtoNotepad£»addr¡¡szUpdateWindow1
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡UpdateWindow£»hWinMain
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡_SendtoNotepad£»addr¡¡szUpdateWindow2
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÃæ´úÂëÖеĴÖÌ岿·Ö¾ÍÊÇÏà¶ÔÓÚFirstWindow³ÌÐòÔö¼ÓµÄÄÚÈÝ£¬ºÃÁË£¬ÏÖÔÚDOS¿ØÖÆ̨ÉϼüÈënmake½«MsgWindow³ÌÐò±àÒë³öÀ´£¬È»ºó´ò¿ª¼Çʱ¾£¬ÔÙÔËÐÐMsgWindow¡£exe£¬Èç¹û¼Çʱ¾ÉϳöÏÖÒ»´ó¶ÑµÄ¶«Î÷£¬¾Í˵Ã÷ʵÑé¿ÉÒÔ¿ªÊ¼ÁË£¡
4¡£4¡£2¡¡¡¡¿ªÊ¼ÊµÑé
ʵÑé1¡£¡¡ÑéÖ¤ÊÕµ½ÏûÏ¢µÄ˳Ðò
´ò¿ª¼Çʱ¾£¬È»ºóÔËÐÐMsgWindow³ÌÐò£¬¼Çʱ¾ÉϳöÏÖµÄÄÚÈÝΪ£º
Creating¡¡Window¡£¡£¡£
WndProc£º¡¡£§0024£§WM_GETMINMAXINFO¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fda4
WndProc£º¡¡£§0081£§WM_NCCREATE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fd8c
WndProc£º¡¡£§0083£§WM_NCCALCSIZE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fdc4
WndProc£º¡¡£§0001£§WM_CREATE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fd68
CreateWindow¡¡end
Showing¡¡Window¡£¡£¡£
WndProc£º¡¡£§0018£§WM_SHOWWINDOW¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000001¡¡00000000
WndProc£º¡¡£§0046£§WM_WINDOWPOSCHANGING¡¡¡¡¡¡00000000¡¡0012fec0
WndProc£º¡¡£§0046£§WM_WINDOWPOSCHANGING¡¡¡¡¡¡00000000¡¡0012fec0
WndProc£º¡¡£§001c£§WM_ACTIVATEAPP¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000001¡¡00000450
WndProc£º¡¡£§0086£§WM_NCACTIVATE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000001¡¡00000000
WndProc£º¡¡£§000d£§WM_GETTEXT¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡000001fe¡¡0012f52c
WndProc£º¡¡£§0006£§WM_ACTIVATE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000001¡¡00000000
WndProc£º¡¡£§0007£§WM_SETFOCUS¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
WndProc£º¡¡£§0085£§WM_NCPAINT¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000001¡¡00000000
WndProc£º¡¡£§000d£§WM_GETTEXT¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡000001fe¡¡0012f52c
WndProc£º¡¡£§0014£§WM_ERASEBKGND¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡e3010449¡¡00000000
WndProc£º¡¡£§0047£§WM_WINDOWPOSCHANGED¡¡¡¡¡¡¡¡00000000¡¡0012fec0
WndProc£º¡¡£§0005£§WM_SIZE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00450064
WndProc£º¡¡£§0003£§WM_MOVE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡004b0038
ShowWindow¡¡end
Updating¡¡Window¡£¡£¡£
WndProc£º¡¡£§000f£§WM_PAINT¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
UpdateWindow¡¡end
Getting¡¡Message¡£¡£¡£
ÒÔWndProc´øÍ·µÄÊÇÔÚ´°¿Ú¹ý³ÌÖÐÊÕµ½µÄÏûÏ¢£¬ÏÔÈ»£¬ºÍ4¡£2¡£4½ÚÖн²ÊöµÄÊÇÒ»Öµģ¬ÔÚµ÷ÓÃCreateWindowExµÄʱºò£¬´°¿Ú¹ý³Ì¾Í¿ªÊ¼½ÓÊÕÏûÏ¢£¬ÀïÃæÓÐÖØÒªµÄWM_CREATE£¬È»ºóÔÚShowWindowµÄʱºò£¬WindowsÏò´°¿Ú¹ý³Ì·¢ËÍÁ˺ܶàµÄÏûÏ¢£¬¶øUpdateWindowÖ»¸ø´°¿Ú¹ý³Ì·¢ËÍÁËÒ»ÌõWM_PAINTÏûÏ¢£¬½ÓÏÂÀ´¾Í½øÈëÁËÏûϢѻ·¡£
¿ÉÒÔ¿´µ½£¬GetMessageº¯ÊýÊdzÌÐòÖ÷¶¯ÉϽ»¿ÕÏÐʱ¼äµÄ°ì·¨Ö®Ò»£¬ÒòΪÏÔʾ³öGetting¡¡Message¡£¡ÒԺ󣬳ÌÐò¾ÍµÈ×ÅÄÇÀïÁË£¬Õâ±íʾ³ÌÐòµÄ¿ÕÏÐʱ¼ä²¢²»ÀË·ÑÔÚÏûϢѻ·ÖУ¬¶øÊÇÔÚGetMessageº¯ÊýÄÚ²¿ÓÉWindows×Ô¼º·ÖÅäÁË¡£
½ÓÏÂÀ´°ÑÊó±êÒƹýMsgWindow´°¿Ú£¬ÔÚ¼Çʱ¾ÉÏ¿´µ½ÁËʲô£¿Óû§Ò»¸öССµÄ¶¯×÷¾Í¹»´°¿Ú¹ý³ÌæµÄ¡ª¡ªÎÒÃÇ¿´µ½Á˶à´ÎÖظ´µÄÏÂÁÐÄÚÈÝ£º
WndProc£º¡¡£§0084£§WM_NCHITTEST¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00830096
WndProc£º¡¡£§0020£§WM_SETCURSOR¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡001b0304¡¡02000001
£§0200£§Message¡¡gotten
Dispatching¡¡Message¡£¡£¡£
WndProc£º¡¡£§0200£§WM_MOUSEMOVE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0038005e
DispatchMessage¡¡end
Getting¡¡Message¡£¡£¡£
Ê×ÏÈ£¬WindowsÔÚGetMessageûÓзµ»ØµÄʱºò¾Íµ÷ÓÃÁËÁ½´Î´°¿Ú¹ý³Ì£¬·Ö±ðÊÇ´¦ÀíWM_NCHITTESTºÍWM_SETCURSOR£¬ËüÃDz¢²»¾¹ýÏûϢѻ·£»È»ºó£¬GetMessageÈ¡µ½£§0200£§ÏûÏ¢²¢·µ»Ø£¬0200ÊÇWM_MOUSEMOVEÏûÏ¢µÄ±àºÅ£»½ÓÏÂÀ´£¬DispatchMessageº¯Êý¿ªÊ¼¹¤×÷£¬ÔÚÕâ¸öº¯ÊýµÄÄÚ²¿£¬ÏûÏ¢±»Windows·¢Ë͸ø´°¿Ú¹ý³Ì´¦Àí£¬×îºóDispatchMessage·µ»Ø£¬È»ºó¿ªÊ¼ÐµÄGetMessage¡£
×îºóÔÚMsgWindowÉϵ¥»÷¡°¹Ø±Õ¡±°´Å¥£¬¿´·¢ÉúÁËʲô£º
£§00a1£§Message¡¡gotten
Dispatching¡¡Message¡£¡£¡£
WndProc£º¡¡£§00a1£§WM_NCLBUTTONDOWN¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000014¡¡003d0097
WndProc£º¡¡£§0215£§WM_CAPTURECHANGED¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
WndProc£º¡¡£§0112£§WM_SYSMAND¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡0000f060¡¡003d0097
WndProc£º¡¡£§0010£§WM_CLOSE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
WndProc£º¡¡£§0046£§WM_WINDOWPOSCHANGING¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fad8
WndProc£º¡¡£§0047£§WM_WINDOWPOSCHANGED¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fad8
WndProc£º¡¡£§0086£§WM_NCACTIVATE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
WndProc£º¡¡£§0006£§WM_ACTIVATE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
WndProc£º¡¡£§001c£§WM_ACTIVATEAPP¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000450
WndProc£º¡¡£§0008£§WM_KILLFOCUS¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
WndProc£º¡¡£§0002£§WM_DESTROY¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
WndProc£º¡¡£§0082£§WM_NCDESTROY¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡00000000
DispatchMessage¡¡end
Getting¡¡Message¡£¡£¡£
£§0012£§Message¡¡gotten
GetMessageÊÕµ½µÄÊÇ°´ÏÂÊó±êµÄWM_NCLBUTTONDOWNµÄÏûÏ¢£¬ÓÉDispatchMessageת¸ø´°¿Ú¹ý³Ì´¦Àíºó£¬´°¿Ú¹ý³Ì½«ËüתÊÖ¸øÁËDefWindowProc£¬DefWindowProc¸ù¾ÝÊó±êµÄλÖõóö½áÂÛ£ºÓû§°´µÄÊÇ¡°¹Ø±Õ¡±°´Å¥£¬·Å¿ªÊó±êºó£¬Ëü¾Í¸ø´°¿Ú¹ý³Ì·¢ËÍWM_CLOSEÏûÏ¢£¬µ±´°¿Ú¹ý³Ìµ÷ÓÃDestroyWindowºó£¬´°¿Ú±»´Ý»Ù£¬´°¿Ú¹ý³Ì×îºóÊÕµ½µÄÊÇWM_DESTROYÏûÏ¢ºÍWM_NCDESTROYÏûÏ¢£¬¶øÏûϢѻ·ÖÐGetMessage×îºóÊÕµ½µÄÊÇ0012ºÅWM_QUITÏûÏ¢£¬ÏûϢѻ·½áÊø¡£
¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡
µÚ4Õ¡¡µÚÒ»¸ö´°¿Ú³ÌÐò
4¡£4¡¡Êµ¡¡Ñ飨3£©
¡¡¡¡¡¡¡¡
ʵÑé2¡£¡¡È«²¿ÏûÏ¢¶¼¾¹ýÏûϢѻ·Âð
ÔÚ×öÕâ¸öʵÑé֮ǰ£¬¶ÁÕßÒѾ֪µÀ²¢²»ÊÇËùÓеÄÏûÏ¢¶¼ÊǾ¹ýÏûϢѻ·µÄ£¬ËüÃÇÖеÄÓÐЩÊÇWindowsÖ±½Ó·¢Ë͵½´°¿Ú¹ý³ÌµÄ£¬ÉÏÒ»¸öʵÑéÖоÍÒѾ¿ÉÒÔ¿´µ½GetMessage·µ»ØµÄ´ÎÊýÃ÷ÏԵرȵ÷Óô°¿Ú¹ý³ÌµÄ´ÎÊýÉÙ£¬ÕâÒâζ×Å´°¿Ú¹ý³ÌÓкܶà´ÎÊÇÓÉWindowsÖ±½Óµ÷Óõġ£
Õâ´Î£¬ÎÒÃÇÓü«¶ËµÄ·½Ê½À´ÑéÖ¤£¬ÏÈ°ÑÏûϢѻ·ÖеÄDispatchMessageÈ¥µô£¬ÕâÑùGetMessageµÃµ½µÄÏûÏ¢½«²»»áÔÙ±»Ë͵½´°¿Ú¹ý³ÌÁË£¬´°¿Ú¹ý³ÌÊÕµ½µÄ¾ÍÊÇÓÉWindowsÖ±½Óµ÷ÓõÄÁË¡£¸Ä±äºóµÄÔ´´úÂë¼ûËù¸½¹âÅÌÖеÄChapter04MsgWindow02Ŀ¼¡£
±àÒëºó£¬Í¬ÑùÏÈ´ò¿ª¼Çʱ¾£¬ÔÙÖ´ÐÐMsgWindow£¬È»ºó½«Êó±êÒƹýMsgWindow´°¿Ú£¬²¢³¢ÊÔ×ŵ¥»÷¡°¹Ø±Õ¡±°´Å¥ºÍË«»÷µÈ¸÷ÖÖ¶¯×÷£»½á¹ûÊÇ´°¿Ú¹ý³Ì»¹ÊÇÔÚ±»µ÷Óãº
WndProc£º¡¡£§0084£§WM_NCHITTEST¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡007e0088
WndProc£º¡¡£§0020£§WM_SETCURSOR¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡0026030c¡¡02000001
WndProc£º¡¡£§0084£§WM_NCHITTEST¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡006c0070
WndProc£º¡¡£§0020£§WM_SETCURSOR¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡0026030c¡¡02000001
¡
ÓÉÓÚûÓÐÁËDispatchMessage£¬´ó²¿·ÖÏûÏ¢±»ºöÂÔÁË£¬´°¿Ú¾ÍÍ£ÔÚÁËÆÁÄ»ÉÏ£¬²»ÄܽøÐÐÒƶ¯¡¢Ëõ·Å»ò¹Ø±ÕµÈ²Ù×÷£¬µ«»¹ÊÇÓÐÒ»²¿·ÖÏûÏ¢Ö±½ÓÓÉWindows·¢Ë͸ø´°¿Ú¹ý³Ì£¬ËüÃÇÊÇÊó±êλÖòâÊÔµÄWM_NCHITTESTÏûÏ¢ºÍÒªÇóÉèÖùâ±êµÄWM_SETCURSORÏûÏ¢£¬ËùÒÔÔÚÊó±êÒƶ¯µ½±ß¿òµÄʱºò£¬Êó±ê¹â±ê»¹ÊÇ»á±ä³ÉË«¼ýÍ·µÄÑù×Ó¡£
ÁíÍ⣬³¢ÊÔ×ŵ¥»÷±ðµÄ´°¿ÚÀ´Çл»½¹µã£¬È»ºóÔÙµ¥»÷±êÌâÀ¸À´ÖØм¤»î´°¿Ú£¬¿ÉÒÔ·¢ÏÖWM_MOUSEACTIVATE£¬WM_ACTIVATEºÍWM_KILLFOCUSµÈÏûÏ¢Ò²ÊDz»¾¹ýÏûϢѻ·µÄ¡£½ÓÏÂÀ´£¬°ÑÒ»¸ö´°¿ÚÒƶ¯µ½MsgWindow´°¿ÚÇ°¸²¸ÇËüµÄλÖã¬ÔÙÒÆ¿ª£¬¿ÉÒÔ·¢ÏÖWM_SYNCPAINTºÍWM_ERASEBKGNDµÈÏûÏ¢Ò²ÊÇÓÉWindowsÖ±½Ó·¢¸ø´°¿Ú¹ý³ÌµÄ¡£
×îºó£¬¹Ø±Õ´°¿Ú£¬µ±È»Õâ¸ö´°¿ÚÖ»ÄÜÓÃCtrl£«Alt£«Del¼üÔÚÈÎÎñ¹ÜÀíÆ÷ÖйرÕÁË£¡
ʵÑé3¡£¡¡TranslateMessageÓÐʲôÓÃ
Ê×ÏÈÖ´ÐÐʵÑé1µÄMsgWindow£¬ÔÚ´°¿ÚÉÏÇü¸¸ö¼ü£¬Ã¿´ÎÇÃÒ»¸ö¼ü£¬µÃµ½µÄÏûÏ¢ÊÇ£ºWM_KEYDOWN£¬WM_CHARºÍWM_KEYUP¡£Èç¹û°´Ï¼üÅ̲»·Å£¬ÔòÊ×Ïȵõ½Ò»¸öWM_KEYDOWN£¬½ÓÏÂÀ´¾ÍÊÇÖظ´µÄWM_CHARºÍWM_KEYUPÏûÏ¢£¬Ö±µ½·Å¿ª¼üÅÌΪֹ£¬×îºó²Å»á¿´µ½Ò»¸öWM_KEYUP¡£ÏÔʾÈçÏ£º
WndProc£º¡¡£§0100£§WM_KEYDOWN¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000041¡¡001e0001
WndProc£º¡¡£§0102£§WM_CHAR¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000061¡¡001e0001
WndProc£º¡¡£§0101£§WM_KEYUP¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000041¡¡c01e0001
ÔÚWM_KEYDOWNºÍWM_KEYUPÏûÏ¢ÖУ¬wParamÖÐÊÇ°´¼üµÄɨÃèÂ룬ÉÏÃæµÄÊý¾ÝÊÇ°´ÏÂÁ˼ü¡°A¡±µÃµ½µÄ£¬00000041hÊÇ¡°A¡±µÄɨÃèÂ룬µ½ÁËWM_CHARÏûÏ¢ÖУ¬wParamÖоÍÊÇÒѾת»»¹ýµÄASCIIÂë61ÁË£¬´ú±íÊäÈëµÄÊÇСдµÄ×Öĸ¡°a¡±¡£
ºÃ£¡ÏÖÔÚ´Ó³ÌÐòÖÐÈ¥µôTranslateMessageÓï¾ä£¨ÐÞ¸ÄÒÔºóµÄÔ´´úÂë·ÅÔÚChapter04MsgWindow03Ŀ¼ÖУ©£¬È»ºó¿´Õâ¸ö³ÌÐòµÄÔËÐнá¹û£¬Í¬Ñù£¬°´¼¸´Î¼üÒÔ¼°°´Ï¼üÅ̲»·Å£¬ÎÒÃÇ·¢ÏÖ£ºÕâÖмäµÄÇø±ð¾ÍÊÇÉÙÁËWM_CHAR£¬ËùÒÔÖ»ÓÐÔÚ´¦Àí¼üÅÌÊäÈëÒªÓõ½×ª»»ºóµÄASCIIÂëµÄʱºò£¬TranslateMessageº¯Êý²ÅÊÇÓÐÓõģ¬ÔÚ±ðµÄʱºòÍêÈ«¿ÉÒÔÊ¡ÂÔÕâ¸öÓï¾ä¡£Õâ¸öº¯ÊýµÄ¹¦ÄܾÍÊÇ¿´µ½WM_KEYDOWNµÄʱºò°ÑÏûÏ¢¼ì²éһϣ¬È»ºó¸ù¾Ý¼üÖµ½«Ò»ÌõеÄWM_CHAR»òWM_SYSCHARÏûÏ¢·ÅÈëÏûϢѻ·ÖС£
ʵÑé4¡£¡¡DefWindowProc×öÁËʲô¹¤×÷
ÏÖÔÚ°ÑDefWindowProcÓï¾äÈ¥µô£¨Ô´´úÂëÏê¼ûChapter04MsgWindow04Ŀ¼£©£¬È»ºóÔÙÒÔͬÑùµÄ·½·¨ÔËÐУ¬´°¿Ú¸ù±¾¾ÍûÓгöÏÖ£¡¿´¼Çʱ¾ÖгöÏÖÁËʲô£º
Creating¡¡Window¡£¡£¡£
WndProc£º¡¡£§0024£§WM_GETMINMAXINFO¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fda4
WndProc£º¡¡£§0081£§WM_NCCREATE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡00000000¡¡0012fd8c
WndProc