windows»·¾³ÏÂ32λ»ã±àÓïÑÔ³ÌÐòÉè¼Æ-µÚ53ÕÂ
°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
ÄǾÍÊÇÎı¾Á÷£¨Text¡¡Streaming£©¡£
¿¼ÂÇÕâÑùÒ»ÖÖÇé¿ö£ºÎªÁË×°ÈëÎı¾£¬¿ÉÒÔÉêÇëÒ»¿é´óСºÏÊʵĻº³åÇø£¨µ±È»²»»á´óµ½ÄÜÈÝÄÉÈ«²¿Îı¾£©£¬Ã¿´Î´ÓÎļþÖжÁÈ뻺³åÇø´óСµÄÎı¾²¢Ìí¼Óµ½¿Ø¼þÖУ¬Èç´ËÑ»·Ö±µ½¶ÁÈëÈ«²¿Îı¾£»±£´æÎı¾µÄʱºò£¬Í¬Ñù¿ÉÒÔÿ´Î´Ó¿Ø¼þÖÐÈ¡³ö»º³åÇø´óСµÄÎı¾£¬È»ºóдÈëÎļþ£¬Èç´ËÑ»·Ö±µ½´¦ÀíÍê¿Ø¼þÖеÄÈ«²¿Îı¾¡£
Îı¾Á÷µÄ²Ù×÷·½·¨Óë´ËÀàËÆ£¬Ö»²»¹ý»º³åÇøºÍÑ»·¶¼·â×°ÔڿؼþµÄÄÚ²¿£¬¶øÎÒÃÇͨ¹ýÌṩ»Øµ÷º¯ÊýµÄ°ì·¨Ìṩ¶ÁдÎļþµÄ¹¦ÄÜÄ£¿é£¬Richedit¿Ø¼þÑ»·µ÷ÓÃÕâ¸öÄ£¿éÖ±µ½´¦ÀíÍêÈ«²¿µÄÄÚÈÝ¡£Ã¿´Îµ÷ÓõÄʱºò£¬¿Ø¼þͨ¹ý²ÎÊý¸æË߻ص÷º¯ÊýÒª¶ÁдµÄ×Ö½ÚÊýºÍ»º³åÇøµÄµØÖ·¡£Îı¾µÄÁ÷ÈëºÍÁ÷³öʹÓÃEM_STREAMINºÍEM_STREAMOUTÏûÏ¢£¬ÕâÁ½¸öÏûÏ¢µÄʹÓøñʽÊÇÒ»ÑùµÄ£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_STREAMIN£»uFormat£»lpStream
¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_STREAMOUT£»uFormat£»lpStream
wParam²ÎÊýÖеÄuFormatÖ¸¶¨ÐèÒªÁ÷Èë/Á÷³öµÄÄÚÈÝ£¬Ëü¿ÉÒÔÊÇÒÔϵÄÈ¡Öµ£º
¡ñ¡¡¡¡¡¡SF_RTF¡ª¡ªÎı¾¸ñʽÊÇRTF¸ñʽ¡£
¡ñ¡¡¡¡¡¡SF_TEXT¡ª¡ªÎı¾ÊÇPlain¡¡Text¸ñʽ£¬Ò²¾ÍÊǼòµ¥µÄÎı¾¸ñʽ¡£
¡ñ¡¡¡¡¡¡SFF_SELECTION¡ª¡ªÁ÷²Ù×÷µÄ·¶Î§Êǵ±Ç°Ñ¡ÔñÇøÓò¡£Èç¹û½«Îı¾Á÷È룬µ±Ç°Ñ¡ÔñÇøÓò¾Í»á±»Ìæ»»£»Èç¹ûÊÇÁ÷³ö£¬ÔòÖ»ÓÐÄÇЩµ±Ç°Ñ¡¶¨µÄÎı¾²ÅÁ÷³ö¡£Èç¹ûûÓÐÖ¸¶¨Õâ¸ö±êÖ¾£¬²Ù×÷·¶Î§ÊǿؼþÖеÄËùÓÐÎı¾¡£
¡ñ¡¡¡¡¡¡SF_UNICODE¡ª¡ªÖ¸¶¨µÄÊÇ¡¡Unicode¡¡Îı¾£¨2¡£0¼°ÒÔÉÏ°æ±¾Ìṩ£©¡£
lParam²ÎÊýÖеÄlpStreamÖ¸ÏòÒ»¸öEDITSTREAM¡¡½á¹¹£¬¸Ã½á¹¹¶¨ÒåÈçÏ£º
¡¡EDITSTREAM¡¡STRUCT¡¡
¡¡¡¡¡¡¡¡dwCookie¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡£»Óû§×Ô¶¨ÒåÖµ
¡¡¡¡¡¡¡¡dwError¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡£»ÓÃÀ´·µ»ØÁ÷²Ù×÷¹ý³ÌÖеĴíÎóÐÅÏ¢
¡¡¡¡¡¡¡¡pfnCallback¡¡DWORD¡¡¡¡¡¡£¿¡¡¡¡¡¡£»»Øµ÷º¯ÊýµØÖ·
EDITSTREAM¡¡ENDS
½á¹¹Öи÷×ֶεÄ˵Ã÷ÈçÏ£º
¡ñ¡¡¡¡¡¡dwCookie¡ª¡ªÓ¦ÓóÌÐò×Ô¶¨ÒåµÄÊýÖµ£¬Õâ¸öÊýÖµ½«»á´«µÝ¸ø»Øµ÷º¯Êý¡£
¡ñ¡¡¡¡¡¡dwError¡ª¡ªÖ¸Ê¾Á÷²Ù×÷µÄ½á¹û£¬0˵Ã÷ûÓдíÎó¡£
¡ñ¡¡¡¡¡¡pfnCallback¡ª¡ªÖ¸Ïò»Øµ÷º¯Êý£¬¸Ãº¯ÊýÓÉÓû§¶¨Ò壬²¢ÓÉRichEdit¿Ø¼þµ÷ÓÃÀ´´«ÊäÎı¾¡£RichEdit¿Ø¼þ½«Îı¾·Ö³É¶à¸ö²¿·Ö£¬Ã¿´Îµ÷Óøú¯Êý´¦ÀíÒ»¸ö²¿·Ö£¬Ö±µ½È«²¿Îı¾±»´¦ÀíΪֹ¡£
»Øµ÷º¯ÊýµÄ¶¨ÒåÈçÏ£º
EditStreamCallback¡¡¡¡proc¡¡¡¡¡¡¡¡dwCookie£»lpBuffer£»NumBytes£»¡¡pBytesTransferred
¿Ø¼þ´«µÝ¸ø»Øµ÷º¯ÊýµÄ²ÎÊý˵Ã÷ÈçÏ£º
¡ñ¡¡¡¡¡¡dwCookie¡ª¡ª¾ÍÊÇÏûÏ¢ÖÐÖ¸¶¨µÄEDITSTREAM½á¹¹Öж¨ÒåµÄdwCookieÖµ¡£
¡ñ¡¡¡¡¡¡lpBuffer¡ª¡ªÖ¸ÏòRichedit¿Ø¼þÌṩµÄ»º³åÇø¡£¶ÔÓÚÁ÷Èë²Ù×÷£¬ÕâÀïÓÃÀ´½ÓÊÕÁ÷ÈëµÄÎı¾£»¶ÔÓÚÁ÷³ö²Ù×÷£¬ÕâÀï´æ·ÅÒªÁ÷³öµÄÎı¾¡£
¡ñ¡¡¡¡¡¡NumBytes¡ª¡ª±¾´Îµ÷ÓÃÖпÉÒÔ²Ù×÷µÄ×Ö½ÚÊý¡£¶ÔÓÚÁ÷Èë²Ù×÷£¬±íʾ¿ÉÒÔдÈ뻺³åÇøµÄ×î´ó×Ö½ÚÊý£»¶ÔÓÚÁ÷³ö²Ù×÷£¬±íʾÐèÒªÁ÷³öµÄÎı¾µÄ³¤¶È¡£
¡ñ¡¡¡¡¡¡pBytesTransferred¡ª¡ªÖ¸ÏòÒ»¸öË«×Ö£¬ÓÉÓÚʵ¼Ê²Ù×÷µÄ×Ö½ÚÊý²»Ò»¶¨µÈÓÚNumBytes²ÎÊýÖ¸¶¨µÄÊýÖµ£¨±ÈÈçÁ÷Èëʱ¶Áµ½ÁËÎļþβ²¿£©£¬²Ù×÷ºó±ØÐëÔÚÕâÀï·µ»Øʵ¼Ê²Ù×÷µÄ×Ö½ÚÊý¡£
»Øµ÷º¯Êý·µ»Ø0˵Ã÷²Ù×÷³É¹¦£¬ÕâÑùÈç¹û»¹ÓÐÊý¾ÝÐèÒª¶Áд£¬RichEdit¿Ø¼þ¾Í»á¼ÌÐøµ÷ÓÃËü¡£Èç¹û²Ù×÷Öз¢ÉúÁË´íÎ󣬶øÇÒ³ÌÐòÐèҪֹͣ²Ù×÷µÄ»°£¬¿ÉÒÔ·µ»ØÒ»¸ö·Ç0Öµ£¬ÕâʱRichedit¿Ø¼þ¾Í»á¶ªÆúlpBufferÖ¸ÏòµÄÊý¾Ý²¢Í£Ö¹¶Ô»Øµ÷º¯ÊýµÄ¼ÌÐøµ÷Óᣵ±ÏûÏ¢·µ»ØµÄʱºò£¬Óɻص÷º¯Êý·µ»ØµÄ´íÎó/³É¹¦Öµ»áÔÚEDITSTREAM½á¹¹µÄdwError×Ö¶ÎÖзµ»Ø£¬ËùÒÔ¿ÉÒÔÔÚSendMessage·µ»ØºóÒԴ˼ì²éÁ÷²Ù×÷ÊÇ·ñ³É¹¦¡£
ÔÚÀý×ÓÎļþÖУ¬½øÐÐÁ÷²Ù×÷ÈçÏ£º
£»¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·
£»¡¡»Øµ÷º¯Êý
£»¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·
_ProcStream¡¡¡¡¡¡¡¡¡¡proc¡¡uses¡¡ebx¡¡edi¡¡esi¡¡_dwCookie£»_lpBuffer£»_dwBytes£»_lpBytes
¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£if¡¡¡¡¡¡¡¡¡¡_dwCookie
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡ReadFile£»hFile£»_lpBuffer£»_dwBytes£»_lpBytes£»0
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£else
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡¡¡WriteFile£»hFile£»_lpBuffer£»_dwBytes£»_lpBytes£»0
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£endif
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xor¡¡¡¡¡¡¡¡¡¡eax£»eax
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ret
¡¡¡¡¡¡¡¡
_ProcStream¡¡¡¡¡¡¡¡¡¡endp
£»¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·
£»¡¡Á÷³ö²Ù×÷
£»¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stES¡£dwCookie£»FALSE¡¡¡¡¡¡¡¡£»¡¡¡¡@stESÊÇÒ»¸öEDITSTREAM½á¹¹
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stES¡£pfnCallback£»offset¡¡_ProcStream
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_STREAMOUT£»SF_TEXT£»addr¡¡@stES
£»¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·
£»¡¡Á÷Èë²Ù×÷
£»¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·¡·
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stES¡£dwCookie£»TRUE
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stES¡£pfnCallback£»offset¡¡_ProcStream
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_STREAMIN£»SF_TEXT£»addr¡¡@stES
³ÌÐòÖÐÁ÷ÈëºÍÁ÷³ö²Ù×÷µÄ»Øµ÷º¯ÊýʹÓÃͬһ¸ö×Ó³ÌÐò£¬Í¨¹ýÉèÖÃEDITSTREAM½á¹¹µÄ×Ô¶¨ÒåÖµdwCookie×Ö¶ÎÀ´±íʾ½øÐеÄÊÇÁ÷È뻹ÊÇÁ÷³öµÄ²Ù×÷£¬×Ó³ÌÐòÖÐͨ¹ýÅжÏdwCookie²ÎÊýÊÇTRUE»¹ÊÇFALSEÀ´¾ö¶¨½øÐжÁÎļþ»¹ÊÇдÎļþµÄ²Ù×÷£¨¶ÁдÎļþµÄº¯ÊýReadFileºÍWriteFileµÄÓ÷¨Çë²Î¿¼µÚ10Õ£©¡£
¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡
µÚ9Õ¡¡Í¨Óÿؼþ
9¡£4¡¡Ê¹ÓÃRichedit¿Ø¼þ£¨9£©
¡¡¡¡¡¡¡¡
5¡£¡¡²éÕÒºÍÌæ»»
ÔÚRichedit¿Ø¼þÖпÉÒÔͨ¹ý·¢ËÍEM_FINDTEXT»òÕßEM_FINDTEXTEXÏûÏ¢À´Íê³É²éÕÒ×Ö·û´®µÄ¹¦ÄÜ£¬EM_FINDTEXTEXÏûÏ¢ÊÇEM_FINDTEXTÏûÏ¢µÄÀ©Õ¹£¬ËüÃǵÄÓ÷¨ÊÇ£º
invoke¡¡¡¡SendMessage£»hWinEdit£»EM_FINDTEXT£»uFlags£»lpFindText
invoke¡¡¡¡SendMessage£»hWinEdit£»EM_FINDTEXTEX£»uFlags£»lpFindTextEx
ÏûÏ¢µÄwParam²ÎÊýÖеÄuFlagsÖ¸¶¨²éÕÒµÄÑ¡ÏËü¿ÉÒÔÊÇÒÔÏÂÈ¡ÖµµÄ×éºÏ£º
¡ñ¡¡¡¡¡¡FR_DOWN£¨2¡£0°æ±¾¼°ÒÔÉÏʹÓã©¡ª¡ªÏòºó²éÕÒ£¬²»ÉèÖõĻ°±íʾÏòÇ°²éÕÒ¡£
¡ñ¡¡¡¡¡¡FR_MATCHCASE¡ª¡ª²éÕÒ×Ö·û´®Çø·Ö´óСд¡£
¡ñ¡¡¡¡¡¡FR_WHOLEWORD¡ª¡ªÆ¥ÅäÕû¸öµ¥´Ê¡£
EM_FINDTEXTµÄlParam²ÎÊýÖ¸ÏòÒ»¸öFINDTEXT½á¹¹£¬¶øEM_FINDTEXTEXÏûÏ¢µÄlParam²ÎÊýÖ¸ÏòÒ»¸öFINDTEXTEX½á¹¹£¬ÕâÁ½¸ö½á¹¹µÄ¶¨ÒåÈçÏ£º
FINDTEXT¡¡STRUCT
¡¡¡¡chrg¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CHARRANGE¡¡¡¡¡¡¡¡£»²éÕÒÇøÓò
¡¡¡¡lpstrText¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡£»²éÕÒ×Ö·û´®µØÖ·
FINDTEXT¡¡ENDS
FINDTEXTEX¡¡STRUCT
¡¡¡¡chrg¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CHARRANGE¡¡¡¡¡¡£»²éÕÒÇøÓò
¡¡¡¡lpstrText¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡£»²éÕÒ×Ö·û´®µØÖ·
¡¡¡¡chrgText¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CHARRANGE¡¡¡¡¡¡£»Èç¹ûÕÒµ½ÔòÔÚÕâÀï·µ»ØÕÒµ½ÎÄ×ÖµÄÆðʼ/½áÊøλÖÃ
FINDTEXTEX¡¡ENDS
¿ÉÒÔ¿´³ö£¬EM_FINDTEXTEXÏûÏ¢µÄÀ©Õ¹Ö®´¦ÔÚÓÚÖ±½ÓÔÚchrgText×Ö¶ÎÖзµ»ØÕÒµ½ÎÄ×ÖµÄÇøÓò£¬³ÌÐò¿ÉÒÔÂíÉÏʹÓÃÕâ¸öÇøÓòÊý¾Ý½øÐÐÆäËû²Ù×÷£¬¶øEM_FINDTEXTÏûÏ¢±ØÐë¸ù¾ÝÕÒµ½µÄλÖúͲéÕÒ×Ö·û´®µÄ³¤¶È×Ô¼º¼ÆËãÕâ¸öÇøÓò¡£
Á½¸öÏûÏ¢µÄ·µ»ØÖµÊÇÒ»ÑùµÄ£¬Èç¹ûûÓÐÕÒµ½Ö¸¶¨ÎÄ×ÖÔò·µ»Ø£¿1£¬·ñÔò·µ»ØÕÒµ½ÎÄ×ÖµÄÆðʼλÖá£Àý×Ó³ÌÐòÔÚ_FindText×Ó³ÌÐòÖÐÍê³É²éÕÒ¹¦ÄÜ£¬Õâ¸ö×Ó³ÌÐò·Ö±ðÔÚ¡°²éÕÒÏÂÒ»¸ö¡±¡¢¡°²éÕÒÉÏÒ»¸ö¡±ºÍ¡°²éÕÒÎÄ×Ö¡±Í¨ÓöԻ°¿òµÄ×Ô¶¨ÒåÏûÏ¢Öб»µ÷Óã¬×Ó³ÌÐòÖÐͨ¹ýÏÂÃæµÄ´úÂëÀ´ÉèÖòéÕÒÇøÓò£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_EXGETSEL£»0£»addr¡¡@stFindText¡£chrg
¡¡¡¡¡¡¡¡¡£if¡¡¡¡¡¡¡¡¡¡stFind¡£Flags¡¡&¡¡FR_DOWN
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡push¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡@stFindText¡£chrg¡£cpMax
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡pop¡¡¡¡¡¡¡¡¡¡@stFindText¡£chrg¡£cpMin
¡¡¡¡¡¡¡¡¡£endif
¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stFindText¡£chrg¡£cpMax£»¡1
µ±ÕÒµ½Ò»¸öÆ¥Åä×Ö·û´®ºó£¬×Ö·û´®±»ÉèÖÃΪѡÔñÇøÓò£¬Èç¹ûÏòϼÌÐø²éÕÒÏÂÒ»¸öµÄ»°£¬±ØÐ뽫Õâ¸öÑ¡ÔñÇøÓòµÄ½áÊøλÖÃÓÃ×öÏÂÒ»´Î²éÕÒµÄÆðʼµã£¬ËùÒÔ³ÌÐò·¢ËÍEM_EXGETSELÏûÏ¢»ñÈ¡Ñ¡ÔñÇøÓò²¢½«cpMax×ֶηŵ½cpMin×Ö¶ÎÖУ¬²¢½«cpMax×Ö¶ÎÉèÖÃΪ¡1£¬±íʾһֱ²éÕÒµ½È«²¿Îı¾µÄ×îºó¡£
ÔÚµÚ8ÕÂÖÐÒѾÓÐËù½éÉÜ£º¡°²éÕÒÎÄ×Ö¡±Í¨ÓöԻ°¿òʹÓÃFINDREPLACE½á¹¹£¬²»ÖªµÀÊÇÇɺϻ¹ÊÇMicrosoftµÄ¹ÊÒâ°²ÅÅ£¬FINDREPLACE½á¹¹ÖеÄFlags×ֶκÍEM_FINDTEXTEXÏûÏ¢ÖеÄwParam²ÎÊýµÄ±êÖ¾¶¨ÒåÊÇÒ»ÑùµÄ£¬ËùÒÔ³ÌÐòÖ±½ÓÈ¡³öFlags×ֶΣ¬È»ºóÆÁ±ÎµôFR_MATCHCASE£¬FR_DOWNºÍFR_WHOLEWORDµÈ²»ÐèҪʹÓõıêÖ¾ÒԺ󣬾ͿÉÒÔÖ±½ÓÔÚÏûÏ¢µÄwParam²ÎÊýÖÐʹÓÃÁË£º
¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡ecx£»stFind¡£Flags
¡¡¡¡¡¡¡¡and¡¡¡¡¡¡¡¡¡¡ecx£»FR_MATCHCASE¡¡or¡¡FR_DOWN¡¡or¡¡FR_WHOLEWORD
¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_FINDTEXTEX£»ecx£»addr¡¡@stFindText
ÕÒµ½×Ö·û´®ÒԺ󣬽øÐÐÌæ»»²Ù×÷¾Í²»ÊÇÒ»¼þ¸´ÔÓµÄÊÂÇéÁË£¬ÒòΪFINDTEXTEX½á¹¹µÄchrgText×Ö¶ÎÖÐÒѾ·µ»ØÁËÕÒµ½Îı¾µÄÆðʼºÍ½áÊøλÖ㬽«ËüÉèÖÃΪѡÔñÇøÓòÒÔºó¾Í¿ÉÒÔͨ¹ý·¢ËÍEM_REPLACESELÏûÏ¢½øÐÐÌæ»»²Ù×÷ÁË¡£
9¡£4¡£3¡¡¡¡Richedit¿Ø¼þµÄ֪ͨÏûÏ¢
Richedit¿Ø¼þÒ²¿ÉÒÔÏò¸¸´°¿Ú·¢ËͶàÖÖ֪ͨÏûÏ¢£¬Ê¹Óá°¿ÉÒÔ¡±Ò»´ÊµÄÒâ˼ÊÇ£¬¿Ø¼þÔÚĬÈÏ״̬ϲ¢²»·¢ËÍ֪ͨÏûÏ¢£¬Èç¹ûÐèÒª¿Ø¼þ·¢ËÍij¸öÏûÏ¢£¬±ØÐëÊ×ÏȶԿؼþ½øÐÐÉèÖá£Í¨¹ýÏòRichedit¿Ø¼þ·¢ËÍEM_SETEVENTMASKÏûÏ¢¿ÉÒÔ¼¤»îÐèÒªµÄ֪ͨÏûÏ¢£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_SETEVENTMASK£»0£»dwMask
dwMaskÊÇʼþÑÚÂ룬¿ÉÒÔÊÇÏÂÃæ±êÖ¾µÄ×éºÏ£¬·Ö±ð´ú±í¼¤»î²»Í¬µÄ֪ͨÏûÏ¢£º
¡ñ¡¡¡¡¡¡ENM_CHANGE¡ª¡ªÔÊÐíEN_CHANGE֪ͨÂ룬±¾ÏûÏ¢ÔÚÓû§µÄ²Ù×÷¿ÉÄܸıä¿Ø¼þÖеÄÎı¾µÄʱºò·¢ËÍ¡£
¡ñ¡¡¡¡¡¡ENM_CORRECTTEXT¡ª¡ªÔÊÐíEN_CORRECTTEXT֪ͨÂë¡£
¡ñ¡¡¡¡¡¡ENM_DRAGDROPDONE¡ª¡ªÔÊÐíEN_DRAGDROPDONE֪ͨÂ룬±¾ÏûÏ¢ÔÚÓû§Íê³ÉÁËÒ»¸öÍϷŲÙ×÷ºó·¢ËÍ¡£
¡ñ¡¡¡¡¡¡ENM_DROPFILES¡ª¡ªÔÊÐíEN_DROPFILES֪ͨÂ룬±¾ÏûÏ¢ÔÚÓû§½«Ò»¸öÎļþÍϷŽø¿Ø¼þºó·¢ËÍ¡£
¡ñ¡¡¡¡¡¡ENM_KEYEVENTS¡ª¡ªÔÊÐíΪ¼üÅÌÏûÏ¢·¢ËÍEN_MSGFILTER֪ͨÂë¡£
¡ñ¡¡¡¡¡¡ENM_MOUSEEVENTS¡ª¡ªÔÊÐíΪÊó±êÏûÏ¢·¢ËÍEN_MSGFILTER֪ͨÂë¡£
¡ñ¡¡¡¡¡¡ENM_PROTECTED¡ª¡ªÔÊÐí·¢ËÍEN_PROTECTED֪ͨÂë¡£
¡ñ¡¡¡¡¡¡ENM_SCROLL¡ª¡ªÔÊÐí·¢ËÍEN_HSCROLLºÍEN_VSCROLL֪ͨÂë¡£
¡ñ¡¡¡¡¡¡ENM_SCROLLEVENTS¡ª¡ªÔÊÐíΪÊó±ê»¬ÂÖ·¢ËÍEN_MSGFILTER֪ͨÂë¡£
¡ñ¡¡¡¡¡¡ENM_SELCHANGE¡ª¡ªÔÊÐí·¢ËÍEN_SELCHANGE֪ͨÂ룬±¾ÏûÏ¢ÔÚÑ¡ÔñÇøÓò¸Ä±äÒÔºó·¢ËÍ£¨°üÀ¨¹â±êλÖøı䣩¡£
¡ñ¡¡¡¡¡¡ENM_UPDATE¡ª¡ªÔÊÐí·¢ËÍEN_UPDATE֪ͨÂ룬±¾ÏûÏ¢Ôڿؼþ½«ÒªÏÔʾ±»¸Ä±äµÄÎı¾Ö®Ç°·¢ËÍ¡£
µ±ÕâЩ֪ͨÏûÏ¢±»¼¤»îµÄʱºò£¬¸¸´°¿Ú¾Í¿ÉÒÔÊÕµ½°üº¬ÏàӦ֪ͨÂëµÄWM_NOTIFYÏûÏ¢¡£Ò»°ãÀ´Ëµ£¬½«¿Ø¼þÉèÖÃΪ½ö·¢ËͳÌÐò¸ÐÐËȤµÄ֪ͨÏûÏ¢£¬Èçµ±ÔÚRichedit¿Ø¼þÖа´ÏÂÓÒ¼üÐèÒªµ¯³öÒ»¸ö²Ëµ¥µÄʱºò£¬ÐèÒª¼ì²âÊó±êÏûÏ¢£¬ÄÇô¾ÍÐèÒªÖ¸¶¨ENM_MOUSEEVENTS±êÖ¾£»ÁíÍ⣬Èç¹ûÐèÒªËæʱ¼ì²âÑ¡ÔñÇøÓòµÄ״̬£¬ÒÔ±ãËæʱÉèÖù¤¾ßÀ¸ÖС°¿½±´¡±Óë¡°¼ôÇС±µÈ°´Å¥µÄ״̬£¬ÄÇô¾ÍҪʹÓÃENM_SELCHANGE±êÖ¾£¬ÕâÑù¹â±êÒ»Òƶ¯»òÕßÑ¡ÔñÇøÓòÒ»¸Ä±ä£¬¸¸´°¿Ú¾Í¿ÉÒÔÊÕµ½EN_SELCHANGE֪ͨÂ룬ÓÚÊdzÌÐò¾Í¿ÉÒÔÔÚWM_NOTIFYÏûÏ¢ÖÐËæʱ¸Ä±ä¹¤¾ßÀ¸Éϸ÷°´Å¥µÄ״̬¡£
ÓÉÓÚRichedit¡£asmÀý×ÓÖÐûÓÐʹÓù¤¾ßÀ¸£¬ËùÒÔûÓжÔ֪ͨÏûÏ¢½øÐÐʾÀý£¬ÓÐÐËȤµÄ¶ÁÕß¿ÉÒԲ鿴Ëù¸½¹âÅ̵ÄChapter09WordpadĿ¼ÖеÄÀý×ÓÎļþ£¬Õâ¸öÀý×ÓÖÐʹÓù¤¾ßÀ¸ºÍ״̬À¸µÈ¿Ø¼þ£¬ÐèÒªËæʱÏÔʾ¹â±êλÖõÈÐÅÏ¢£¬³ÌÐòÖоͰüº¬ÁË´¦Àí֪ͨÏûÏ¢µÄ´úÂë¡£
¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡
µÚ9Õ¡¡Í¨Óÿؼþ
9¡£5¡¡´°¿ÚµÄ×ÓÀ໯£¨1£©
¡¡¡¡¡¡¡¡
9¡£5¡£1¡¡¡¡Ê²Ã´ÊÇ´°¿ÚµÄ×ÓÀ໯
ÔÚʹÓÿؼþµÄ¹ý³ÌÖУ¬³£³£»áÓöµ½ÕâÑùÒ»ÖÖÇé¿ö£ºÎÒÃÇÐèÒªÒ»ÖÖ´°¿Ú£¬ËüºÍijÖÖÏֳɵĿؼþÌṩµÄ¹¦ÄܺÜÏàËÆ£¬Èç¹ûʹÓÃÏֳɿؼþµÄ»°£¬ÄÇô¿Ø¼þ¼¸ºõÄÜÌṩËùÓÐÐèÒªµÄ¹¦ÄÜ£¬½öÎÒÃÇÒªÇóµÄij¸öϸ½ÚÎÞ·¨ÊµÏÖ¡£¾ÙÀýÀ´Ëµ£¬Òª±àдһ¸ö16½øÖÆÓë10½øÖƵÄת»»³ÌÐò£¬³ÌÐòÖÐÐèÒªÁ½¸ö±à¼¿Ø¼þÀ´ÊäÈëÊýÖµ£¬ÊäÈë10½øÖÆÊýÖµ¿ÉÒÔʹÓÃÏֳɵÄEdit¿Ø¼þ£¬Ö»ÒªÖ¸¶¨ES_NUMBER·ç¸ñ¾ÍÄÜÈñ༿òÖ»ÄÜÊäÈëÊý×Ö0¡«9£¬µ«ÊäÈë16½øÖÆÊýÖµµÄʱºò¾Í²»ÐÐÁË£¬ÒòΪָ¶¨ES_NUMBER·ç¸ñµÄ»°¾ÍÎÞ·¨ÊäÈëA¡«F£¬²»Ö¸¶¨µÄ»°Óû§¾Í¿ÉÄÜÊäÈë0¡«9ºÍA¡«FÖ®ÍâµÄ¶«Î÷£¬ÄÇô¸ÃÈçºÎ´¦ÀíÄØ£¿
½â¾öµÄ°ì·¨ÓÐÁ½ÖÖ£¬µÚÒ»ÖÖµ±È»ÊÇ×Ô¼º´´½¨Ò»¸ö´°¿ÚÀ࣬ȻºóÔÚ×Ô¼ºµÄ´°¿Ú¹ý³ÌÖÐÍê³ÉËùÓеŦÄÜ£¬ÕâÏÔÈ»ÊÇÒ»Ïî·ÑʱÓÖ·ÑÁ¦µÄ¹¤×÷£¬ÒòΪÎÒÃǼ¸ºõÒª×Ô¼ºÖØÐÂдһ±éEdit¿Ø¼þµÄÈ«²¿¹¦ÄÜ£»µÚ¶þÖÖ·½·¨¾ÍÊÇʹÓñ¾½ÚÒª½éÉܵĴ°¿Ú×ÓÀ໯£¬´°¿Ú×ÓÀ໯×îÊʺÏ×öµÄ¾ÍÊÇÕâÒ»À๤×÷¡£
´°¿Ú×ÓÀ໯µÄº¬ÒåÊǽӹܱ»×ÓÀ໯µÄ¿Ø¼þ´°¿Ú£¬ÒÔ´ïµ½¶ÔËü½øÐпØÖƵÄÄ¿µÄ¡£ËäÈ»¿Ø¼þµÄ´°¿Ú¹ý³Ì±»·â×°ÔÚWindowsÄÚ²¿£¬ÎÞ·¨¶ÔËü½øÐÐÖ±½ÓÐ޸ģ¬µ«Ö»ÒªÄܽػñWindows¸ø¿Ø¼þµÄ´°¿Ú¹ý³Ì·¢Ë͵ÄÏûÏ¢£¬¾ÍÄܹ»¿ØÖƿؼþ´°¿Ú¡£ÒÔÉÏÃæµÄÒªÇóΪÀý£¬Ö»Òª½Ø»ñWindowsÏò±à¼¿Ø¼þ·¢Ë͵ÄWM_CHARÏûÏ¢£¬¾ÍÄܹ»¸ù¾ÝÐèÒª¶ªÆú°üº¬·Ç16½øÖÆ×Ö·ûµÄWM_CHARÏûÏ¢£¬Ö»°Ñ°üº¬16½øÖÆ×Ö·ûµÄWM_CHARת·¢¸ø¿Ø¼þµÄ´°¿Ú¹ý³Ì£¬ÕâÑù±à¼¿Ø¼þ½«¸ù±¾ÊÕ²»µ½16½øÖÆ×Ö·ûÖ®ÍâµÄ×Ö·û£¬ÎÒÃǵÄÒªÇóÒ²¾Í´ïµ½ÁË¡£
¿Ø¼þ´°¿Ú×ÓÀ໯µÄÁ÷³ÌÈçͼ9¡£8Ëùʾ¡£
×ÓÀ໯µÄ²Ù×÷²¢²»¾ÖÏÞÓڿؼþ´°¿Ú£¬Êµ¼ÊÉÏÈκδ°¿Ú¶¼¿ÉÒÔ×ÓÀ໯¡£µ«ÊǶÔÓÚÓ¦ÓóÌÐò×ÔÉíʹÓõĴ°¿ÚÀàÀ´Ëµ£¬ËüµÄ¿ØÖÆȨ±¾À´¾ÍÊÇ100£¥ÊôÓÚÓ¦ÓóÌÐò×ÔÉíµÄ£¬ÒªÊµÏÖijÖÖ¹¦ÄܾÍÖ±½ÓÐÞ¸ÄÔ´´úÂëºÃÁË£¬Ã»ÓбØÒªÔÙ½øÐÐÒ»¸ö×ÓÀ໯µÄ¹ý³Ì£¬ËùÒÔ×ÓÀ໯µÄ²Ù×÷ÍùÍùÊǶԡ°ºÚÏ»×Ó¡±ÀàÐ͵Ŀؼþ´°¿Ú½øÐеġ£
ͼ9¡£8¡¡¡¡´°¿Ú×ÓÀ໯µÄ¹¤×÷ÔÀí
9¡£5¡£2¡¡¡¡´°¿Ú×ÓÀ໯µÄʵÏÖ
´°¿Ú×ÓÀ໯µÄÒªµãÊǽػñ´°¿ÚµÄ´°¿Ú¹ý³Ì£¬ÈçºÎʵÏÖÕâÒ»µãÄØ£¿Ã¿¸ö´°¿ÚµÄÄÚ²¿¶¼±£´æÓÐËüËùÊôµÄ´°¿ÚÀàµÄWNDCLASSEX¡¡½á¹¹£¬½á¹¹ÖеÄlpfnWndProc×Ö¶ÎÖ¸³öÁË´°¿Ú¹ý³ÌµÄµØÖ·£¬Èç¹ûÄÜÓÃ×Ô¼ºµÄ´°¿Ú¹ý³ÌµØÖ·À´Ìæ»»Õâ¸öµØÖ·£¬ÄÇôWindows¾Í»á°ÑÏûÏ¢·¢Ë͵½×Ô¶¨ÒåµÄ´°¿Ú¹ý³ÌÖÐÀ´ÁË¡£Í¨¹ýµ÷Óú¯ÊýSetWindowLong¿ÉÒÔʵÏÖÕâ¸ö¹¦ÄÜ£¬SetWindowLongº¯ÊýµÄÓ÷¨ÊÇÕâÑùµÄ£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡SetWindowLong£»hWnd£»nIndex£»dwNewLong
¡¡¡¡¡¡¡¡mov¡¡dwOldLong
hWnd²ÎÊ