°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
»ÓõÄ×Ö·û´®£¬×Ö·û´®ÒÔ0½áβ¡£
³ýÁË»ñÈ¡ºÍÉèÖÃÎÄ×Ö£¬»¹ÓÐһϵÁеĿØÖÆÏûÏ¢¿ÉÒÔÓÃÀ´½øÐж¨Î»²Ù×÷£¬±ÈÈçÏëҪѡ¶¨Ò»ÕûÐÐÄÚÈÝ£¬¾Í±ØÐëÖªµÀijһÐеÄÆðʼλÖúͽáÊøλÖã»ÁíÍ⣬ÓÐʱºòÒ²ÐèÒªÔÚ×Ö·ûλÖúÍÐкÅÖ®¼ä½øÐÐת»»¼ÆË㣬¶ÔÓÚÕâЩҪÇ󣬰ÑËùÓÐÎı¾´Ó¿Ø¼þÖжÁ³öÀ´ÔÙ×Ô¼º½øÐд¦ÀíÏÔÈ»ÊǺÜÂé·³µÄ£¬ÐÒºÃRichedit¿Ø¼þÒѾÌṩÁËÕâЩ¹¦ÄÜ¡£
ͨ¹ý·¢ËÍEM_EXLINEFROMCHARÏûÏ¢¿ÉÒÔµÃÖªÖ¸¶¨µÄ×Ö·ûλÓÚÄÄÒ»ÐÐÖУº
invoke¡¡¡¡SendMessage£»hWinEdit£»EM_EXLINEFROMCHAR£»0£»dwCharPos
¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡dwLine£»eax
ÆäÖÐdwCharPosÖ¸³ö×Ö·ûµÄλÖã¨ÒÔ0¿ªÊ¼£©£¬ÏûÏ¢½«·µ»Ø×Ö·ûËù´¦µÄÐкš£ÔÚËùÓÐÕâЩÏûÏ¢ÖУ¬×Ö·ûλÖúÍÐкŶ¼ÊÇ´Ó0¿ªÊ¼¼ÆËãµÄ£¬Ò²¾ÍÊÇ˵µÚ1ÐеÄÐкÅÓÃ0±íʾ¡£
EM_LINEINDEXÏûÏ¢ÔòÍê³ÉÄæÔËË㣬Ëü·µ»ØÖ¸¶¨ÐкŵĵÚÒ»¸ö×Ö·ûµÄλÖã¬dwLine²ÎÊýΪÊäÈëµÄÐкţ¬Èç¹ûdwLine²ÎÊýÊäÈ룿1µÄ»°£¬´ú±íµÄÊǵ±Ç°ÐУ¨¹â±êËùÔÚµÄÐУ©£º
invoke¡¡¡¡SendMessage£»hWinEdit£»EM_LINEINDEX£»dwLine£»0
mov¡¡dwCharPos£»eax
¸ÃÏûÏ¢·µ»ØÖ¸¶¨ÐеÄÆðʼ×Ö·ûµÄλÖã¬Èç¹ûÖ¸¶¨µÄÐкų¬¹ýÁ˿ؼþÖÐÎı¾µÄ×ÜÐÐÊý£¬ÄÇôÏûÏ¢½«·µ»Ø£¿1¡£¿Ø¼þÖаüº¬Îı¾µÄ×ÜÐÐÊý¿ÉÒÔͨ¹ýEM_GETLINECOUNTÏûÏ¢»ñÈ¡£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_GETLINECOUNT£»0£»0
¡¡¡¡¡¡¡¡mov¡¡dwTotalLines£»eax
Èç¹ûÏë»ñȡijһÐеij¤¶È£¬Óкü¸ÖÖ·½·¨£¬±ÈÈç¿ÉÒÔÁ½´ÎʹÓÃEM_LINEINDEXÏûÏ¢»ñÈ¡±¾ÐкÍÏÂÒ»ÐÐÎÄ×ÖµÄÆðʼλÖã¬ÔÙÏà¼õ¾ÍµÃ³öÁËÐеij¤¶È£»Ò²¿ÉÒÔÓÃEM_LINELENGTHÖ±½Ó»ñÈ¡£º
invoke¡¡¡¡SendMessage£»hWinEdit£»EM_LINELENGTH£»ich£»0
mov¡¡dwLineLength£»eax
²»¹ýEM_LINELENGTHÏûÏ¢ÖеÄich²ÎÊý²¢²»ÊÇÐкţ¬¶øÊÇÐÐÖÐÈÎÒâÒ»¸ö×Ö·ûµÄλÖã¬ËùÒÔÏëÒÔÐкÅΪ²ÎÊý»ñÈ¡Ðг¤¶ÈµÄ»°£¬»¹ÐèÒªÏÈÓÃEM_LINEINDEXÏûÏ¢½«ÐкÅת»»µ½×Ö·ûλÖúóÔÙʹÓÃEM_LINELENGTHÏûÏ¢¡£Õâ¸öÏûÏ¢»¹ÓиöÌØÊâÓÃ;£¬µ±ich²ÎÊýÖ¸¶¨Îª¡1µÄʱºò£¬·µ»ØÖµÊÇÑ¡¶¨ÇøÓò¿çÔ½µÄ¶à¸öÐÐÖÐûÓб»Ñ¡¶¨µÄ×Ö·ûµÄ×ÜÊý£¬ÕâÓÐʲôÓô¦ÄØ£¿ÏÔÈ»£¬µ±°´ÏÂÁËDelete¼üɾ³ýÁËÑ¡ÔñÇøÓòʱ£¬Ê£ÏµÄÐеij¤¶È¾ÍÊÇÕâ¸ö·µ»ØÖµ¡£
ÒªÏë»ñȡijһÐеÄÄÚÈÝÒ²ÓжàÖÖ°ì·¨£¬±ÈÈç¿ÉÒÔÏÈÑ¡¶¨Ä³¸öÐУ¬ÔÙÓÃEM_GETSELTEXTÏûÏ¢À´Íê³É£¬µ«×î¼òµ¥µÄ°ì·¨ÊÇʹÓÃEM_GETLINEÏûÏ¢£º
¡¡¡¡¡¡¡¡mov¡¡word¡¡ptr¡¡szBuffer£»sizeof¡¡szBuffer
¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_GETLINE£»dwLine£»addr¡¡szBuffer
ÆäÖÐdwLine²ÎÊýÖ¸¶¨Òª»ñÈ¡µÄÐкţ¬lpBuffer²ÎÊýÖ¸ÏòÓÃÀ´½ÓÊÕ×Ö·û´®µÄ»º³åÇø£¬×¢Ò⣺»º³åÇøµÄµÚÒ»¸ö×Ö£¨²»ÊÇË«×Ö£¡£©±ØÐëÔ¤ÏÈÖ¸¶¨Îª»º´æÇøµÄ³¤¶È£¡ÁíÍ⣬½ÓÊÕµÄ×Ö·û´®²¢²»°üÀ¨½áÊø·û0£¬ËùÒÔÔÚ·¢ËÍÏûϢ֮ǰ×îºÃÏÈ°Ñ»º³åÇøÈ«²¿ÇåÁ㣬·ñÔò»áºÍ»º³åÇøÖÐÔÓеÄÊý¾Ý»ìÔÚÒ»Æð¡£ÏûÏ¢µÄ·µ»ØÖµÊÇ·µ»Øµ½»º³åÇøÖеÄ×Ö·û´®µÄ³¤¶È¡£
3¡£¡¡ÉèÖÃÎı¾¸ñʽ
Richedit¿Ø¼þÖ§³ÖÁ½ÖÖģʽ£º´ø¸ñʽÎı¾RTF£¨Rich¡¡Text¡¡Format£©Ä£Ê½ºÍ²»´ø¸ñʽÎı¾£¨Plain¡¡Text£©Ä£Ê½¡£ÔÚĬÈÏ״̬Ï¿ؼþ´¦ÓÚRTFģʽ£¬ÔÚÕâÖÖģʽÏ£¬³ÌÐò¿ÉÒԶԿؼþÖеIJ»Í¬ÎÄ×Ö·Ö±ðÉèÖò»Í¬µÄ¸ñʽ£¬ÕâЩ¸ñʽ¿ÉÒÔ±»±£´æµ½*¡£rtfÎļþÖС£¶øÔÚPlain¡¡TextģʽÏ£¬Ö»Äܽ«¿Ø¼þÖеÄÈ«²¿ÎÄ×ÖÉèÖÃͳһµÄ¸ñʽ£¬¶øÇÒÕâЩ¸ñʽ½ö±íÏÖÔÚ¡°ÏÔʾ¡±ÉÏ£¬²»»á±»±£´æµ½*¡£txtÎļþÖС£
Ôڿؼþ´°¿Ú±»´´½¨ºó¿ÉÒÔͨ¹ý·¢ËÍEM_SETTEXTMODEÏûÏ¢À´ÉèÖù¤×÷ģʽ£¬ÕâÌõÏûÏ¢½ö¶Ô2¡£0°æ±¾ÒÔÉϵÄRichedit¿Ø¼þÓÐЧ£º
invoke¡¡¡¡SendMessage£»hWinEdit£»EM_SETTEXTMODE£»dwTextMode£»0
µ±dwTextMode²ÎÊýÖ¸¶¨Îª¡¡TM_PLAINTEXT¡¡µÄʱºò£¬¿Ø¼þÇл»µ½²»´ø¸ñʽģʽ£»Ö¸¶¨ÎªTM_RICHTEXTµÄʱºò£¬¿Ø¼þÇл»µ½RTFģʽ¡£Õâ¸öÏûÏ¢Ò²¿ÉÒÔÓÃÀ´ÉèÖÃÖØ×ö/³·ÏúµÄģʽ£¬ÔÚdwTextMode²ÎÊýÖÐͬʱָ¶¨TM_SINGLELEVELUNDO±êÖ¾¿ÉÒÔ½«¿Ø¼þÉèÖÃΪµ¥¼¶ÖØ×ö/³·Ïúģʽ£»Ö¸¶¨TM_MULTILEVELUNDO±êÖ¾ÔòÉèÖÃΪ¶à¼¶ÖØ×ö/³·Ïúģʽ¡£
ÒªÉèÖÃÎı¾¸ñʽ¿ÉÒÔͨ¹ý·¢ËÍEM_SETCHARFORMATÏûÏ¢£¬Õâ¸öÏûÏ¢ÉèÖÿؼþÖÐÒ»¶ÎÑ¡¶¨µÄÎı¾»òÕßÈ«²¿ÕýÎĵĸñʽ£¬ÏûÏ¢µÄÓ÷¨ÈçÏ£º
invoke¡¡¡¡SendMessage£»hWinEdit£»EM_SETCHARFORMAT£»uFlags£»lpFmt
uFlags²ÎÊý±íʾָ¶¨µÄ¸ñʽËùÓ¦Óõķ¶Î§£¬Ëü¿ÉÒÔÊÇÏÂÃæµÄÊýÖµ¡£
¡ñ¡¡¡¡¡¡SCF_ALL¡ª¡ªÎª¿Ø¼þÖеÄÈ«²¿Îı¾ÉèÖÃÖ¸¶¨µÄ¸ñʽ¡£
¡ñ¡¡¡¡¡¡SCF_SELECTION¡ª¡ª½öΪѡÔñÇøÓòÉèÖÃÖ¸¶¨µÄ¸ñʽ£¬Èç¹ûÑ¡ÔñÇøÓòΪ¿Õ£¬ÔòÒÔºóÔÚ´ËλÖòåÈëµÄÐÂ×Ö·ûʹÓô˸ñʽ¡£
¡ñ¡¡¡¡¡¡SCF_WORD¡¡ÓëSCF_SELECTION¡ª¡ª½«¸ñʽӦÓõ½Ñ¡¶¨µÄµ¥´ÊÉÏ£¬Èç¹ûÑ¡ÔñÇøÓòûÓÐÂäÔÚÕû¸öµ¥´ÊÉÏ£¬ÄÇô¸ñʽ»áÀ©Õ¹µ½Õû¸öµ¥´ÊÉÏ£¬SCF_WORD±êÖ¾±ØÐëºÍSCF_SELECTION±êÖ¾Ò»ÆðʹÓá£
lpFmt²ÎÊýÔòÖ¸ÏòÒ»¸öCHARFORMAT»òCHARFORMAT2½á¹¹£¬CHARFORMAT½á¹¹¿ÉÒÔÔÚËùÓа汾ÖÐʹÓ㬶øCHARFORMAT2½á¹¹½ö¿ÉÒÔÔÚ2¡£0¼°ÒÔÉϰ汾ʹÓã¬CHARFORMAT2½á¹¹ÊÇCHARFORMAT½á¹¹µÄÀ©Õ¹£¬ÏÂÃæÊÇCHARFORMAT2½á¹¹µÄ¶¨Ò壺
CHARFORMAT2¡¡STRUCT
¡¡¡¡CbSize¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»½á¹¹³¤¶È
¡¡¡¡dwMask¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»×Ö¶ÎÑÚÂë
¡¡¡¡dwEffects¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»ÎÄ×ÖЧ¹û
¡¡¡¡yHeight¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»ÎÄ×ָ߶È
¡¡¡¡yOffset¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡crTextColor¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»Îı¾ÑÕÉ«
¡¡¡¡bCharSet¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡BYTE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡bPitchAndFamily¡¡¡¡¡¡BYTE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡szFaceName¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡BYTE¡¡LF_FACESIZE¡¡dup£¨£¿£©¡¡£»×ÖÌåÃû³Æ
£»CHARFORMAT½á¹¹µÄ¶¨Òåµ½´ËΪֹ
¡¡¡¡wWeight¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡WORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡sSpacing¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡WORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡crBackColor¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡lcid¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡dwReserved¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡sStyle¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡WORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡wKerning¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡WORD¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡bUnderlineType¡¡¡¡¡¡¡¡BYTE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡bAnimation¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡BYTE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿¡¡
¡¡¡¡bRevAuthor¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡BYTE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
¡¡¡¡bReserved1¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡BYTE¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¿
CHARFORMAT2¡¡ENDS
CHARFORMAT2½á¹¹ÖÐszFaceName×Ö¶ÎÒÔÇ°µÄÄÚÈݾÍÊÇCHARFORMAT½á¹¹£¬½á¹¹Öи÷×ֶεĺ¬ÒåÈçÏ¡£
¡ñ¡¡¡¡¡¡cbSize¡ª¡ª½á¹¹µÄ´óС£¬¿Ø¼þʹÓøÃ×Ö¶ÎÀ´ÅжϽṹµÄ°æ±¾ÊÇCHARFORMAT»¹ÊÇ¡¡CHARFORMAT2£¬ËùÒÔÔÚ½«½á¹¹´«µÝ¸ø¿Ø¼þÇ°±ØÐ뽫Õâ¸ö×Ö¶ÎÉèÖÃΪÕýÈ·µÄÊýÖµ¡£
¡ñ¡¡¡¡¡¡dwMask¡ª¡ª×Ö¶ÎÑÚÂ룬ÓÃÀ´Ö¸¶¨½á¹¹ÖÐÄÄЩ×Ö¶ÎÊÇÓÐЧµÄ£¬Èç¹ûûÓÐʹÓöÔÓ¦µÄ±êÖ¾£¬¼´Ê¹Ä³Ð©×ֶεÄÄÚÈݱ»ÉèÖ㬿ؼþÒ²²»»áʹÓÃËü£¬dwMaskÖпÉÒÔʹÓõıêÖ¾¿ÉÒÔÊÇÏÂÃæÊýÖµµÄ×éºÏ£º
¡ö¡¡¡¡¡¡CFM_BOLD¡ª¡ªdwEffects×Ö¶ÎÖÐCFE_BOLD¡¡ÖµÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_CHARSET¡ª¡ªbCharSet×Ö¶ÎÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_COLOR¡ª¡ªcrTextColor×ֶκÍdwEffectsÖеġ¡CFE_AUTOCOLOR¡¡ÖµÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_FACE¡ª¡ªszFaceName×ֶεÄÖµÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_ITALIC¡ª¡ªdwEffects×Ö¶ÎÖеÄCFE_ITALICÖµÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_OFFSET¡ª¡ªyOffset×Ö¶ÎÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_PROTECTED¡ª¡ªdwEffects×Ö¶ÎÖеÄCFE_PROTECTEDÖµÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_SIZE¡ª¡ªyHeight×Ö¶ÎÊÇÓÐЧµÄ¡£
¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡
µÚ9Õ¡¡Í¨Óÿؼþ
9¡£4¡¡Ê¹ÓÃRichedit¿Ø¼þ£¨8£©
¡¡¡¡¡¡¡¡
¡ö¡¡¡¡¡¡CFM_STRIKEOUT¡ª¡ªdwEffects×Ö¶ÎÖеÄCFE_STRIKEOUTÖµÊÇÓÐЧµÄ¡£
¡ö¡¡¡¡¡¡CFM_UNDERLINE¡ª¡ªdwEffects×Ö¶ÎÖеÄCFE_UNDERLINEÖµÊÇÓÐЧµÄ¡£
¡ñ¡¡¡¡¡¡dwEffects¡ª¡ª×Ö·ûЧ¹û£¬¿ÉÒÔÊÇÒÔÏÂÖµµÄ×éºÏ£º
¡ö¡¡¡¡¡¡CFE_AUTOCOLOR¡ª¡ªÊ¹ÓÃϵͳÕýÎÄÑÕÉ«¡£
¡ö¡¡¡¡¡¡CFE_BOLD£¬CFE_ITALIC£¬CFE_STRIKEOUTºÍCFE_UNDERLINE¡ª¡ª´ÖÌå×Ö·û¡¢Ð±Ìå×Ö·û¡¢´øɾ³ýÏߺʹøÏ»®Ïß¡£
¡ö¡¡¡¡¡¡CFE_PROTECTED¡ª¡ª×Ö·ûÊÇÊܱ£»¤µÄ£¬Æóͼ¸Ä±ä×Ö·ûµÄ»°¿Ø¼þ»áÏò¸¸´°¿Ú·¢ËÍÒ»¸öEN_PROTECTED֪ͨÏûÏ¢¡£
¡ñ¡¡¡¡¡¡yHeight¡ª¡ª×Ö·û¸ß¶È£¬µ¥Î»ÊÇ1/1¡¡440¡¡Ó¢´ç£¨»ò1/20°õ£©£¬Èç¹ûÕâÀïÊÇ180£¬»»Ëãµ½¡°×ÖÌåÑ¡Ôñ¡±Í¨ÓöԻ°¿òÖеijߴç¾ÍÊÇ9°õ£¨180¡Á1/20=9£©¡£
¡ñ¡¡¡¡¡¡yOffset¡ª¡ª´Ó»ùÏßËãÆðµÄ×Ö·ûÆ«ÒÆ£¬µ¥Î»Í¬ÉÏ£¬Èç¹û¸Ã³ÉÔ±ÊÇÕýÖµ£¬×Ö·ûÏÔʾΪÉϱꣻÈç¹ûÊǸºÖµ£¬×Ö·ûÏÔʾΪϱꡣ
¡ñ¡¡¡¡¡¡crTextColor¡ª¡ªÕýÎÄÑÕÉ«£¬Èç¹ûÔÚdwEffects×Ö¶ÎÖÐÖ¸¶¨ÁËCFE_AUTOCOLOR±êÖ¾£¬ÄÇôÕâ¸öÖµ»á±»ºöÂÔ¡£
¡ñ¡¡¡¡¡¡bCharSetºÍbPitchAndFamily¡ª¡ª×Ö·û¼¯¡£
¡ñ¡¡¡¡¡¡szFaceName¡ª¡ªÓÃ×Ö·û´®±íʾµÄ×ÖÌåÃû×Ö¡£
ͨ¹ýÌî³äÕâ¸ö½á¹¹²¢½«Ëüͨ¹ýEM_SETCHARFORMATÏûÏ¢´«Ë͸ø¿Ø¼þ£¬¿ÉÒԸıäÎÄ×ÖµÄЧ¹û£¨´ÖÌ塢бÌå¡¢´øɾ³ýÏß¡¢´øÏ»®Ïߵȣ©£¬ÕýÎÄÑÕÉ«£¨crTextColor£©£¬×ÖÌåÍâ¹Û£¨szFaceName£©ºÍ×ÖÌå´óС£¨yHeight£©£¬ÒÔ¼°Ê¹ÓõÄ×Ö·û¼¯µÈ¡£Ê¹ÓÃCHARFORMAT2½á¹¹¿ÉÒÔÉèÖøü¶àµÄÎı¾·ç¸ñ£¬Èç×Ö¼ä¾àÓëÕýÎı³¾°É«µÈ¡£Èç¹û²»ÐèÒªÕâЩ¶îÍâµÄ¹¦ÄÜ£¬ÄÇôֻҪʹÓÃCHARFORMAT½á¹¹¾Í¿ÉÒÔÁË¡£
Àý×Ó³ÌÐòRichedit¡£asmÖÐÖ»ÑÝʾÁËʹÓÃPlain¡¡TextģʽΪËùÓÐÎı¾ÉèÖÃ×ÖÌåµÄ·½·¨£º
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡nst
szFont¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡'ËÎÌå'£»0
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡de
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_SETTEXTMODE£»TM_PLAINTEXT£»0
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡RtlZeroMemory£»addr¡¡@stCf£»sizeof¡¡@stCf
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stCf¡£cbSize£»sizeof¡¡@stCf
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stCf¡£yHeight£»9¡¡*¡¡20
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡@stCf¡£dwMask£»CFM_FACE¡¡or¡¡CFM_SIZE¡¡or¡¡CFM_BOLD
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡lstrcpy£»addr¡¡@stCf¡£szFaceName£»addr¡¡szFont
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡SendMessage£»hWinEdit£»EM_SETCHARFORMAT£»0£»addr¡¡@stCf
³ÌÐòÊ×ÏȽ«¿Ø¼þµÄģʽÉèÖÃΪPlain¡¡Textģʽ£¬È»ºó¶¨ÒåÁËÒ»¸öÃûΪ@stCfµÄCHARFORMAT½á¹¹£¬½«½á¹¹³¤¶ÈÉèÖÃΪCHARFORMAT½á¹¹µÄ³¤¶È£¬È»ºóÔÚdwMask¡¡×Ö¶ÎÖÐʹÓÃCFM_FACE£¬¡¡CFM_SIZEºÍCFM_BOLD±êÖ¾£¬±íʾֻʹÓÃ×ÖÌå¡¢×ÖÌå´óСºÍ×ÖÌå´Öϸ²ÎÊý£¬×îºó·¢ËÍEM_SETCHARFORMATÏûÏ¢½«¿Ø¼þÖеÄÈ«²¿ÎÄ×ÖÉèÖÃΪ´óСΪ9°õ£¨Ð¡ÎåºÅ£©µÄ¡°ËÎÌ塱¡£
4¡£¡¡×°ÈëºÍ±£´æÎı¾
ÏÔÈ»£¬Ê¹ÓÃGetWindowTextºÍSetWindowTextº¯ÊýÀ´±£´æºÍ×°ÈëÎı¾ÊÇ¿ÉÐеģ¬µ«ÊÇRichEdit¿Ø¼þÖ§³ÖºÜ´óµÄÎļþ£¬µ±Îļþ×ã¹»´óµÄʱºò£¬Ê¹ÓÃÕâÖÖ·½·¨¾ÍºÜÂé·³£¬ÒòΪ±ØÐëÊ×ÏÈÒª·ÖÅäÒ»¿é×ã¹»´óµÄÄÚ´æÓÃ×ö»º³åÇø£¬ÎªÁ˽â¾öÕâ¸öÎÊÌ⣬Richedit¿Ø¼þÌṩÁËÒ»ÖÖз½·¨£¬ÄǾÍÊÇÎı¾Á÷£¨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
³ÌÐòÖÐÁ÷ÈëºÍÁ÷³ö²Ù×÷µÄ»Øµ÷º¯ÊýʹÓÃͬһ¸ö×Ó³ÌÐò£¬Í¨¹ýÉèÖÃEDITSTREA