³o¤@³¹Á¿zªº¬O¡A¦p¦ó¦bµ{¦¡¤¤§ïÅܹϥܤδå¼Ð¡C
Win64 µ{¦¡¥i¤À¬°¨â¤jÃþ¡G①¶È¨ã¦³©R¥O¦C¤¶±¡]command-line interface¡A²ºÙ CLI¡^ªº±±¨î»Oµ{¦¡¡B②¨ã¦³¹Ï§Î¨Ï¥ÎªÌ¤¶±¡]Graphical User Interface¡A²ºÙ GUI¡^ªºµøµ¡µ{¦¡¡C¦b²Ä¤@¦Ü¤»³¹¤¶²Ðªº³£ÄÝ©ó«eªÌ¡A²Ä¤C³¹¤Î¨ä¥H«á¤¶²ÐªºÄÝ©ó«áªÌ¡C¹ï¨Ï¥ÎªÌ¨Ó»¡¡A¨Ï¥Î¹Ï§Î¤¶±¯àÅý¾Þ§@§óª½Ä±¡B§ó¿Ë©M¡C¦]¦¹¦b Windows §@·~¨t²Î¤¤¡A¥Dnªºµ{¦¡³£ÄÝ©ó¨ã¦³¹Ï§Î¨Ï¥ÎªÌ¤¶±ªºµøµ¡µ{¦¡¡C
¨ã¦³¹Ï§Î¨Ï¥ÎªÌ¤¶±ªºµøµ¡µ{¦¡¡A¬O¥Ñ¨â³¡¤À²Õ¦¨ªº¡G①µ{¦¡½X»P②UI ¸ê·½¡]UI ¬O user interface ªºÁY¼g¡^¡C¦¹³Bªºµ{¦¡½X¬O«ü¸ê®Æ°Ï¬q¡Bµ{¦¡½X°Ï¬q¡B°ïÅ|°Ï¬q³o¨Ç¤º®e¡A«D³æ³æ«ü x86 «ü¥Oªºµ{¦¡½X¡C¦Ó UI ¸ê·½«h¬O¥]§t¿ï³æ¡]menu¡^¡B¹Ï¥Ü¡]icon¡^¡B´å¼Ð¡]cursor¡^¡B¦ì¤¸¹Ï¡]bitmap¡^¡B¦r«¬¡]font¡^¡B¹ï¸Ü²°¡]dialog box¡^¡Bª©¥»¸ê°T¡]version¡^¡K¡Kµ¥µ¥¡C³o¨Ç¸ê·½³£¥H¹Ï§Î¤è¦¡¡AÅã¥Ü¦bµ{¦¡µøµ¡¤º¡A¨Ñ¨Ï¥ÎªÌ¨Ï¥Î¡C
²£¥Í³o¨Ç¸ê·½©Ò¨Ï¥Îªº³nÅ餣ºÉ¬Û¦P¡A©Ò±o°ÆÀɦW¤]¤£¤@¼Ë¡A¨Ò¦p¹Ï¥ÜÀɪº°ÆÀɦW¬O *.ICO¡A´å¼ÐÀɪº°ÆÀɦW¬O *.CUR¡A¤£¤@¦Ó¨¬¡F¤]¦³¨Ç¸ê·½´N¬O¤å¦r¡A¨Ò¦p¿ï³æ¡B¹ï¸Ü²°¡C¤£½×¦p¦ó¡A³o¨Ç¸ê·½³Ì«á³£¥²¶·©ñ¦b¤@ÓºÙ¬°¡u¸ê·½´yzÀÉ¡v¡]resource-definition script file¡^ªº¤å¦rÀÉùØ´yz¡C¸ê·½´yzÀɪº°ÆÀɦW³q±`¬O *.RC¡C¸ê·½´yzÀɦA¥æ¥Ñ¸ê·½½sĶ¾¹¡]RC.EXE¡^½sĶ¦¨¸ê·½ÀÉ¡A¸ê·½Àɪº°ÆÀɦW³q±`¬O *.RES¡C³Ì«á¦A¥Ñ³sµ²¾¹¡]LINK.EXE¡^§â¸ê·½ÀÉ¡B¥ØªºÀÉ¥H¤Îµ{¦¡®w³sµ²¦b¤@°_¡A²£¥Í¥i°õ¦æÀÉ¡]*.EXE¡^¡C
¤U¹Ï¬O¥Î²Õ¦X»y¨¥¶}µo Win64 µ{¦¡ªº¬yµ{²¹Ï¡C¥ª°¼¨â¦æ¬O¦b³o¤@³¹¤§«e¤w¸g¨Ï¥Î¹Lªº¬yµ{¡A²z¨ä¬yµ{¡G§Ú̥Τå®Ñ³B²z¾¹¡A¨Ò¦p UltraEdit32¡B°O¨Æ¥»µ¥³nÅ鼶¼g¨Ã½s¿èì©lµ{¦¡¡A«Ý¼¶¼g§¹²¦¦s¦¨ *.ASM ÀɧY¬°ì©lµ{¦¡¡FµM«á¥Î²ÕĶ¾¹¡A¤]´N¬O ML64.EXE ©Î UASM64.EXE ²ÕĶ¡A»s³y¥X¥ØªºÀÉ¡F³Ì«á¥Î³sµ²¾¹±N¥ØªºÀÉ»Pµ{¦¡®w³sµ²¡A³y¥X¥i°õ¦æÀÉ¡C¤W¹Ï¥k°¼¨â¦æ¡A«h²z¤F¸ê·½´yzÀÉ¡C¦pªGn¦bµ{¦¡¤¤¥[¤W¿ï³æ¡B¹Ï¥Üµ¥ UI ¸ê·½¡A¨º»ò¥²¶·§Q¥Î¤å®Ñ³B²z¾¹½s¿è¸ê·½´yzÀÉ¡A¸ê·½´yzÀɪº°ÆÀɦW¬O RC¡A«Ý¸ê·½´yzÀɼ¶¼g§¹¦¨¡A¥H¸ê·½½sĶ¾¹¡A¨Ò¦p RC.EXE ½sĶ RC ÀÉ¡A»s³y¥X¸ê·½ÀÉ¡C¸ê·½ÀÉ°ÆÀɦW¬O RES¡A¥i¥H¥Î³sµ²¾¹¨Ï¨ä»P¥ØªºÀÉ¡Bµ{¦¡®w³sµ²°_¨Ó¡A»s³y¥X¥i°õ¦æÀÉ¡AEXE ÀÉ¡C
¤W¹Ï¤¤°£¤Fì©lµ{¦¡¡B¸ê·½´yzÀɬO¤å¦rÀÉ¡A¥i¥H¥Î UltraEdit32¡B°O¨Æ¥»µ¥¤å®Ñ³B²z¾¹¶}±Ò©Î½s¿è¡Fµ{¦¡®w¡B¥ØªºÀÉ¡B¸ê·½ÀÉ¡B¹Ï¥ÜÀÉ¡B´å¼ÐÀÉ¡B¦ì¤¸¹Ï³£¬O¤G¶i¦ìÀÉ¡A¤]´N¬O¤£¯à¥Î UltraEdit32¡B°O¨Æ¥»µ¥¤å®Ñ³B²z¾¹¶}±Ò©Î½s¿èªºÀɮס]§Y¨Ï¯à¶}±Ò¡A¤]¬Ý¤£À´¦³¤°»ò·N¸q¡^¡C
©³¤U´N¨Ó»¡¤@»¡¦p¦ó¦b¸ê·½´yzÀɤ¤¥[¤J¹Ï¥ÜÀɤδå¼ÐÀÉ¡A¨Ã¦bµ{¦¡¤¤§ó´«¹Ï¥Ü¤Î´å¼Ð¡C
¸ê·½´yzÀÉ¡]resource-definition script file¡^ªº°ÆÀɦW¬O RC¡A¬O¤@ºØ¤å¦rÀÉ¡Aùر¥]§tµÛ¦UºØ UI ¸ê·½¡C³o¨Ç UI ¸ê·½¤¤¡A¦³¨Ç¬O¤G¶i¦ìÀÉ¡A¥²¶·¥H¤å¦r´yz¸Ó¤G¶i¦ìÀÉ¡A¨Ò¦p¹Ï¥Ü¡B´å¼Ð¡F¦³¨Ç¬O¤å¦r¡Aª½±µ©ó¸ê·½´yzÀɤ¤ÄÄz§Y¥i¡A¨Ò¦p¿ï³æ¡B¹ï¸Ü²°¡C©³¤U¥ý¬Ý¦p¦ó¦b¸ê·½´yzÀɤ¤©w¸q¹Ï¥Ü¤Î´å¼Ð¡A¥H«á´X³¹¤~»¡©ú¨ä¥Lªº±¡§Î¡C
¦b¸ê·½´yzÀÉùزK¥[¹Ï¥Ü¡A¥i¥ÎÃöÁä¦r¡uICON¡v¡A»yªk¦p¤U¡G
¹Ï¥Ü¦WºÙ ICON ¹Ï¥ÜÀɦWºÙ
¹Ï¥Ü¦WºÙ¥i¥H¬O¦r¦ê¡A¤]¥i¥H¬O¤Q¤»¦ì¤¸ªºµL¸¹¼Æ¡A¤£ºÞ¬Oþ¤@ºØ¡A³£¥Î¨Ó¥N´À¨ä«áªº¹Ï¥ÜÀɦWºÙ¡C¹Ï¥ÜÀɦWºÙ«e«á¥i¥H¥[¤W¡u"¡v¡A¤]¥i¥H¤£¥[¡F¦ý¦pªG¹Ï¥ÜÀɦWºÙ¤¤¦³ªÅ¥Õ¡A´N¥²¶·¥[¤W¡u"¡v¡C¹Ï¥ÜÀɦWºÙ¤]¥i¥H¥]§t¸ô®|¡A¦Ó¨ä¸ô®|¤¤ªº¨âÓ¤l¥Ø¿ý¤§¶¡¡A¥i¥H¥Î¡u\¡v©Î¡u/¡v°µ¬°¤À¹j¨âÓ¤l¥Ø¿ý¦WºÙ¡F¦ý¬O¹³¡u\n¡v¡B¡u\t¡v·|·í¦¨´«¦æ¦r¤¸¤Î¤ô¥©w¦ì¦r¤¸¡A¶·ª`·N¡C¨Ò¦p©³¤Uªº¨Ò¤l¡G
2000 ICON SPLWND2.ICO /* ¥¿½T */ SPLWND2 ICON "../THREAD/SPLWND2.ICO" /* ¥¿½T */ SPLWND2 ICON "..\THREAD\SPLWND2.ICO" // ¿ù»~¡A¦]¬°¡u\T¡v·|³Q·í°µ¤ô¥©w¦ì¦r¤¸
¹Ï¥Ü¦WºÙ¤]¥i¥H¬O¤Q¤»¦ì¤¸ªºµL¸¹¼Æ¡A¤Q¤»¦ì¤¸ªºµL¸¹¼Æ¥²¶·¬O¤p©ó©Îµ¥©ó 65535 ªº¥¿¾ã¼Æ¡A¦¹µL¸¹¼Æ¥Nªí¹Ï¥ÜªºÃѧO½X¡C¨Ò¦p¤W±ªº²Ä¤@Ó¨Ò¤l¡C
n¦b¸ê·½´yzÀÉùزK¥[´å¼Ð¡A¨Ï¥ÎÃöÁä¦r¡uCURSOR¡v¡A»yªk¦p¤U¡G
´å¼Ð¦WºÙ CURSOR ´å¼ÐÀɦWºÙ
´å¼Ð¦WºÙ»P´å¼ÐÀɦWºÙªº³W«h¡A¸ò¹Ï¥Ü¬Û¦P¡A¤£¦AÂØz¡A½Ð°Ñ¦Ò¤W± ICON ªº»¡©ú¡C
¸ê·½´yzÀɦ³¦Û¤vªºÃöÁä¦r»P»yªk¡A©³¤U¦A¤¶²Ð¸ê·½´yzÀɤ¤±`¨£ªº¨âºØÃöÁä¦r¡G①#define¡B②¡u/*¡v»P¡u*/¡v¡B¡u//¡v¡C
¥Ñ«e±ªº¨Ò¤l¡A¨ä¹ê´N¯à²q´ú¡A¦b¸ê·½´yzÀɤ¤ªºµù¸Ñ¦³¨âºØ¡G①¥H¡u/*¡v·í°µµù¸Ñªº¶}©l¡A¥H¡u*/¡v¬°µ²§À¡A³oºØµù¸Ñ¥i¥H¸ó¶V«Ü¦h¦æ¡A¾A¦X¥Î©ó¸ûªøªºµù¸Ñ¡C②¡u//¡v¡A¦b³o¨âÓ¦r¤¸¤§«áªº¤å¦r´N¬Oµù¸Ñ¡A³Ì¦h¥u¯à¤@¦æ¡C
³o¨âºØµù¸Ñªº¤è¦¡³£¬O C »y¨¥ªº»yªk¡A³o¤j·§¬O·L³n¦b¼¶¼g Windows §@·~¨t²Î®É¡A¥H C »y¨¥¬°¥DÅé¡A°t¥H¤Ö¶qªº²Õ¦X»y¨¥¡C¦]¦¹¹³ RC.EXE ³oºØ¤u¨ãµ{¦¡¡A¤]¿í¦u C »y¨¥ªº»yªk¡C
¦b¸ê·½´yzÀɤ¤¡A¦pªGn©w¸q±`¼Æ¡A¥i¥H¥Î¡u#define¡v¡A©w¸q¬YÓ±`¼Æ¤§«á¡A¦¹±`¼Æ§@¥Î½d³ò¥u¯à¬O³oӸ귽´yzÀÉ¡C¡u#define¡v»yªk¦p¤U¡G
#define ±`¼Æ¦WºÙ ¼ÆÈ
nª`·Nªº¬O¡u#define¡v¥²¶·¥Î¤p¼g¦r¥À¡A¤£¯à¥Î¤j¼g¡A¨Ò¦p¡u#DEFINE¡v´N·|µo¥Í¿ù»~¡C©³¤Uªº¨Ò¤l¡A©w¸q¤F±`¼Æ TEXT_CUR ¬° 5000¡G
#define TEXT_CUR 5000
¦b¸ê·½´yzÀɤ¤¡A¥H¡uICON¡vÃöÁä¦r²K¥[¹Ï¥Ü¤§«á¡A¥u¯à¦bÀÉ®×Á`ºÞ¤¤¨£¨ì¸Óµ{¦¡¥H¹Ï¥Ü¥N´À¡C¦pªGn¦bµøµ¡¼ÐÃDÄ檺³Ì¥ªÃ䨣¨ì¹Ï¥Ü¡A¦³¨âºØ¤èªk¥i¥H¹F¨ì³oӥتº¡G²Ä¤@ºØ¤èªk¬O¦bµù¥Uµøµ¡Ãþ§O®É¡A«ü©w¹Ï¥Ü¡F²Ä¤GºØ¤èªk¬O«Ø¥ßµøµ¡¤§«á¡A¦b³B²z WM_CREATE °T®§®É¡A©I¥s SendMessage «ü©w¹Ï¥Ü¡C
²Ä¤@ºØ¤èªk¬O¦bµù¥Uµøµ¡Ãþ§O®É¡A«ü©w¹Ï¥Ü¡A³oºØ¤èªk¦³¤TÓ¨BÆJ¡G
hIconSm »P hIcon ¥i¥H¬O¤£¦Pªº¹Ï¥Ü¥N½X¡A¨º´N·|¦b¼ÐÃDÄæ»P¤u§@¦CÅã¥Ü¤£¦Pªº¹Ï¥Ü¡F¤]¥i¥H¬O¬Û¦Pªº¹Ï¥Ü¥N½X¡A¨º»ò¦b¼ÐÃDÄæ»P¤u§@¦C´N·|Åã¥Ü¦P¼Ëªº¹Ï¥Ü¡A³o¤]¬O¤j³¡¤Àµ{¦¡ªº¿ï¾Ü¡C¤@¯ë¦Ó¨¥¡AhIconSm ¹Ï¥Ü¤j¤p¬° 16¡Ñ16¡AhIcon «h¤£¤@©w¡A¦ý³o¨Ã¤£«n¡A¦]¬° Windows §@·~¨t²Î·|¦b¤£¦P¦a¤è¦Û°Ê½Õ¾ã¤j¤p¡C
©³¤UÁ|Ó¨Ò¤l»¡©ú¡C°²³]¤w¸g±qºô¸ô¤W¤U¸ü¬YӹϥÜÀÉ¡AGIRL.ICO¡A¨º»ò¥ý§â GIRL.ICO¡B¸ê·½´yzÀÉ¡Bì©lµ{¦¡³£©ñ¦b¦P¤@¤l¥Ø¿ýùØ¡C¦b¸ê·½´yzÀÉùØ¥i¥H¼g¦¨¤U±ªº¼Ë¤l¡G
ICONNAME ICON "GIRL.ICO"
©Î
#define ID_ICON 1200 ID_ICON ICON "GIRL.ICO"
«eªÌ¨Ï¥Î¦r¦ê¡A¡uICONNAME¡v¡A¥Nªí¹Ï¥ÜÀÉ¡A«áªÌ¬O¥ÎÃѧO½X¡A¤]´N¬O¼ÆÈ¡AID_ICON¡A¨Ó¥Nªí¹Ï¥ÜÀÉ¡]ID_ICON¤§È¬° 1200¡^¡A¨âªÌ¬Ò¥i¡C±µ¤U¨Ó¥ýºt¥Ü¥Î¦r¦ê¥Nªí¹Ï¥ÜÀɮɡAn¦p¦ó¦bì©lµ{¦¡¤¤¨Ï¥Î¹Ï¥Ü¡C¦bì©lµ{¦¡¤¤¡A¥i¥H¼g¦¨¤U±ªº¼Ë¤l¡G
.DATA ⁝ szIconName DB "ICONNAME",0 ⁝ .CODE ⁝ invoke LoadIcon,hInstance,OFFSET szIconName mov wc.hIcon,rax ;wcªº¸ê®ÆÃþ«¬¬OWNDCLASSEX¡A¦¹¨BÆJ¦s¤J¹Ï¥Ü¥N½X mov wc.hIconSm,rax ;¦s¤J¤p¹Ï¥Ü¥N½X
¦pªG¬O¥ÎÃѧO½X¨Ó¥Nªí¹Ï¥ÜÀɮɡAì©lµ{¦¡¤¤¡A¥i¥H¼g¦¨¤U±ªº¼Ë¤l¡G
ID_ICON EQU 1200 .CODE ⁝ invoke LoadIcon,hInstance,ID_ICON mov wc.hIcon,rax ;wcªº¸ê®ÆÃþ«¬¬OWNDCLASSEX¡A¦¹¨BÆJ¦s¤J¹Ï¥Ü¥N½X mov wc.hIconSm,rax ;¦s¤J¤p¹Ï¥Ü¥N½X
²Ä¤GºØ¤èªk¡A¥i¥H¦b«Ø¥ßµøµ¡¤§«á§ïÅܹϥܡA³q±`¬O¦b³B²z WM_CREATE °T®§®É§ïÅܹϥܡC§ó¶i¤@¨B¨Ó»¡¬O¦³¨âÓ¨BÆJ¡G¥ý©I¥s LoadIcon ¸ü¤J¹Ï¥Ü¡AµM«á©I¥s SendMessage §â³]©wn¹Ï¥Üªº°T®§¤Î¹Ï¥Ü¥N½X¶Çµ¹µøµ¡¡C¨BÆJ¤@¤§«e´N¥Î¹L¤F¡A¤£»¡©ú¡C²Ä¤GÓ¨BÆJ¬O¥H²Ä¤@Ó¨BÆJªº¶Ç¦^ªº¹Ï¥Ü¥N½X¥H¤Î WM_SETICON ¬°°Ñ¼Æ¡A©I¥s SendMessage ¨Ó³]©w¹Ï¥Ü¡C¥ý¬Ý¬Ý SendMessage ªº¥Îªk¡C
SendMessage ±N¬YÓ°T®§¶Ç°eµ¹¬YÓµøµ¡ªºµøµ¡¨ç¦¡¡A¨ä¹ê´N¬O¨Ï¨t²Î©I¥s¸Óµøµ¡ªºµøµ¡¨ç¦¡¡Aª½¨ì³B²z§¹¦¹°T®§¤~ªð¦^¡CSendMessage ªº¥Îªk¦p¤U¡G
invoke SendMessage,\ hWnd,\ ; handle of destination window Msg,\ ; message to send wParam,\ ; first message parameter lParam ; second message parameter
hWnd ¬O±Nn¦¬¨ì°T®§ªºµøµ¡¤§µøµ¡¥N½X¡A¦pªG hWnd ¬° HWND_BROADCAST ªº¸Ü¡A¨º»ò©Ò¦³ªº³»¯Åµøµ¡³£·|¦¬¨ì°T®§¡]³»¯Åµøµ¡¬O top-level windows¡A¬O«ü¥Ñ¨Ï¥ÎªÌ©ÎÀ³¥Îµ{¦¡ª½±µ«Ø¥ßªºµøµ¡¡A¦Ó¤£¬O§@¬°¨ä¥Lµøµ¡ªº¤lµøµ¡¡^¡CMsg ¬O§Y±Nnµo°eµ¹ hWnd ªº°T®§¤§°T®§ÃѧO½X¡CwParam »P lParam ¬O¸Ó°T®§ªºÃB¥~¸ê®Æ¡A»P°T®§ºØÃþ¦³Ãö¡CSendMessage ªº¦^¶ÇÈ»P°T®§ÃѧO½X¦³Ãö¡C
°²¦pn³]©wµøµ¡ªº¹Ï¥Ü¡A¨º»ò¥i¥H¨Ï¥Î¤U±ªº¨BÆJ¡G
WndProc PROC hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM ⁝ .case WM_CREATE invoke LoadIcon,hInstance,OFFSET szIconName invoke SendMessage,hWnd,WM_SETICON,ICON_SMALL,rax
SendMessage ¹ï¦Û¤v¡A¤]´N¬O hWnd µo°e WM_SETICON °T®§¡A¸Ó°T®§ªº·N«ä´N¬O Windows ¨t²În³]©w hWnd ªº¹Ï¥Ü¡CWM_SETICON ªº wParam ¥i¥H¬O ICON_SMALL ©Î ICON_BIG¡A«eªÌ¥Nªí³]©w¼ÐÃDÄ楪Ã䪺¹Ï¥Ü¡A«áªÌ¥Nªí³]©w°õ¦æ«á¦b¤u§@¦Cªº¹Ï¥Ü¡CWM_SETICON ªº lParam ¬O¹Ï¥Ü¥N½X¡A¬O LoadIcon ªº¦^¶ÇÈ¡C
SendMessage ªº¦^¶ÇȬ°µøµ¡ì¥ýªº¹Ï¥Ü¥N½X¡A°²¦pì¥ý¨S¦³¹Ï¥Üªº¸Ü¡A´N·|¶Ç¦^ 0¡C¤@¯ë¦Ó¨¥¡Aµøµ¡¨ç¦¡¤£³B²z WM_SETICON °T®§¡A¦Ó¬O¥æµ¹ DefWindowProc ³B²z¡C
¦bµ{¦¡¤¤n§ïÅܷƹ«´å¼Ð¡A¸ò§ïÅܹϥܪº¤èªk¤@¼Ë¡A³£¬O¦b¸ê®Æ°Ï©w¸q»P¸ê·½´yzÀɬۦPªº´å¼Ð¦WºÙ©Î´å¼ÐÃѧO½X¡A±µ¤U¨Ó¤]¦³¨âºØ¤èªk¥i¥H§ïÅÜ´å¼Ð¡G²Ä¤@ºØ¤èªk¬O¦bµù¥Uµøµ¡Ãþ§O®É¡A«ü©w´å¼Ð¡F²Ä¤GºØ¤èªk¬O©I¥s SetCursor «ü©w´å¼Ð¡C
µù¥Uµøµ¡Ãþ§O®É¥i¥H©I¥s LoadCursor ¨ú±o´å¼Ð¥N½X¡A¦b³o¤§«e§Ú̳£¨Ï¥Î Windows ¨t²Î¤º«Øªº´å¼Ð¡A¨Ò¦p IDC_ARROW¡AµM«á§â WNDCLASSEX ªº hCursor Äæ¦ì«ü©w¬°´å¼Ð¥N½X§Y¥i¡C·íµM¤]¥i¥H¨Ï¥Î¨Ï¥ÎªÌ´£¨Ñªº´å¼Ð¡A¥u»Ý±N LoadCursor ªº²Ä¤GӰѼƧ令¨Ï¥ÎªÌ´£¨Ñªº´å¼Ð¦WºÙ§Y¥i¡C¦]¬°¤è¦¡»P¹Ï¥Ü¤@¼Ë¡A´N¤£¦AÁ|¨Ò»¡©ú¡C
¥ý¨Ó»¡©ú²o¯A¨ì´å¼Ð¨âÓ Win64 API¡GSetCursor »P ShowCursor¡C
·íµù¥U§¹µøµ¡Ãþ§O«á¡AÁÙ¬O¥i¥H§ïÅܷƹ«´å¼Ð¡A¤èªk´N¬O©I¥s SetCursor API¡CSetCursor 쫬¦p¤U¡G
invoke SetCursor,\
hCursor ; handle of cursor
SetCursor ¥u¦³¤@ӰѼơAhCursor¡A´å¼Ð¥N½X¡A¦¹´å¼Ð¥N½X¥i¯à¬O CreateCursor ©Ò«Ø¥ßªº¡A©Î¬O LoadCursor¡BLoadImage ©Ò¸ü¤Jªº¡C¦pªG¦¹°Ñ¼Æ¬° 0¡A¨º»ò´å¼Ð´N·|®ø¥¢¡CSetCursor ªº¦^¶ÇȬO쥻ªº´å¼Ð¥N½X¡C
n¨Ï¥Î SetCursor «ü©w´å¼Ð¡A¥²¶·¦b³B²z WM_SETCURSOR °T®§¤¤©I¥s SetCursor¡Cì¦]¬O¨C·í·Æ¹«²¾°Ê®É¡A¨t²Î·|¹ïµøµ¡¨ç¦¡µo¥X WM_SETCURSOR °T®§¡A¥H«Ã¸·Æ¹«´å¼Ð¡C¤@¯ëµøµ¡¨ç¦¡¤£³B²z³o«h°T®§¡A¦Ó¬O¥æ¥Ñ DefWindowProc ³B²z¡ADefWindowProc ªº³B²z¤è¦¡¬O¥Îµøµ¡Ãþ§O¤¤¡AWNDCLASSEX µ²ºcÅ骺 hCursor Äæ¦ì©Ò«ü©wªº´å¼Ðø»s¡C
°£«D¦bµù¥U¦¡µ¡Ãþ§O®É¡A±N¸ÓÄæ¦ì«ü©w¬°¹s¡A§_«h¥un¤@²¾°Ê·Æ¹«¡A·Æ¹«´å¼Ð«K·|«ì´_¦¨¸ÓÄæ¦ì«ü©wªº´å¼Ð¡C¦ý¬O¦pªGµøµ¡¨ç¦¡¦Û¦æ³B²z WM_SETCURSOR °T®§®É¡A´N¤£·|¥X²{³oºØ°ÝÃD¡C
ShowCursor ¥Î¨ÓÅã¥Ü©ÎÁôÂ÷ƹ«´å¼Ð¡A¥u¦³¤@ӰѼơA¥Îªk¦p¤U¡G
invoke ShowCursor,\
bShow ; cursor visibility flag
¦b Windows §@·~¨t²Î¤º³¡¦³Óp¼Æ¾¹¡A¥u¦³·í¦¹p¼Æ¾¹¤j©ó¹s¤~·|Åã¥Ü·Æ¹«¡C·í¨t²Î¤¤¦w¸Ë¦n·Æ¹«®É¡A¦¹p¼Æ¾¹¬° 0¡FY¥¼¦w¸Ë·Æ¹«¡Ap¼Æ¾¹¬°¡Ð1¡CShowCursor ªº¥Î³~¥Î¨Ó¼W´î¦¹p¼Æ¾¹¤§È¡A·í bShow ¬°«D¹s®É¡Ap¼Æ¾¹¤§È¥[¤@¡F·í bShow ¬° 0 ®É¡Ap¼Æ¾¹´î¤@¡CShowCursor ªº¦^¶ÇȬ°¼W´î«áªºp¼Æ¾¹¤§È¡C
¨C·í·Æ¹«²¾°Ê¥B¨S¦³·Æ¹«¿é¤J°Ê§@®É¡A¨t²Î´N·|¹ïµøµ¡¨ç¦¡µo¥X WM_SETCURSOR °T®§¡A¥H«Ã¸·Æ¹«´å¼Ð¡CWM_SETCURSOR °T®§ªº wParam ¬O·Æ¹«´å¼Ð©Ò¦bªºµøµ¡¥N½X¡C
WM_SETCURSOR °T®§ªº lParam ªº 0¡ã15 ¦ì¤¸¬OÀ»¤¤´ú¸Õ¡]hit-test¡^µ²ªG¡AÀ»¤¤´ú¸Õ¬O«ü·Æ¹«´å¼Ð¦b¦ì¸m¤£¦P¡A¦Ó¦³¤£¦Pµ²ªG¡C¨Ò¦p·Æ¹«´å¼Ð¦b¤u§@°Ï®É¡AÀ»¤¤´ú¸Õ¬O HTCLIENT¡F¦b¿ï³æ°Ï°ì®É¡A¬O HTMENU¡F¦b³Ì¤p¤Æ«ö¶s®É¡A¬O HTMINBUTTON¡F¦b³Ì¤j¤Æ¯Ã®É¡A¬O HTMAXBUTTON¡K¡Kµ¥µ¥¡C³o¨Ç´ú¸Õµ²ªG³£¬O¤p©ó 65536 ªº¥¿¾ã¼Æ¡ClParam ªº 16¡ã31 ¦ì¤¸¬O·Æ¹«°T®§¡A³q±`¬O WM_MOUSEMOVE¡A¦ý¬O¦pªG·Æ¹«¦b¿ï³æ°Ï°ì¡A«h¦¹¼ÆȬ°¹s¡C
©³¤U¤p¤ì°¸§Q¥Î²Ä¤Q¤@³¹ªº SPLWND_U.ASM¡A±N¨ä§ï¼g¡A·sªºµ{¦¡ºÙ¬° SPLWND2.ASM¡A¥¦·|§ïÅܹϥܤηƹ«´å¼Ð¦Ó¤£¨Ï¥Î Windows ©Ò´£¨Ñªº¡Cª`·N¨ì¼ÐÃDÄ楪Ã䪺¹Ï¥Ü¡A¸ò SPLWND_U ¨Ï¥Î Windows ¨t²Î¤¤¤º«Øªº¹Ï¥Ü¤£¦P¡C°£¦¹¤§¥~¡ASPLWND2 ªº·Æ¹«´å¼Ð¦b¤@¯ëª¬ºA®É¡A¬°Ä_¼Cªº¼Ë¤l¡A¨£¤U¹Ï¥ª¡F·í¥¦²¾¦Ü¦r¦ê¤W®É¡AÅܦ¨½s¿èª¬ºAªº¼Ë¤l¡A¨£¤U¹Ï¥k¡G
©³¤U¬O SPLWND2.ASM ªºì©lµ{¦¡¤º®e¡G
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
25 26 27 28
29 30 31 32
33 34 35 36
37 38 39 40
41 42 43 44
45 46 47 48
49 50 51 52
53 54 55 56
57 58 59 60
61 62 63 64
65 66 67 68
69 70 71 72
73 74 75 76
77 78 79 80
81 82 83 84
85 86 87 88
89 90 91 92
93 94 95 96
97 98 99 100
101 102 103 104
105 106 107 108
109 110 111 112
113 114 115 116
117 118 119 120
121 122 123 124 |
OPTION CASEMAP:NONE
OPTION WIN64:3
INCLUDE WINDOWS.INC
INCLUDELIB GDI32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
TEXT_CUR EQU 5000 ;´å¼Ð¦b¤å¦r¤Wªº´å¼Ð¦WºÙ
;***************************************************************************************************
.DATA
hInstance HINSTANCE ? ;¼Ò²Õ¥N½X
hwnd HWND ? ;µøµ¡¥N½X
wc WNDCLASSEX <>
msg MSG <>
ps PAINTSTRUCT <>
rect RECT <>
str_rect RECT <>
szCursorName LABEL BYTE
szIconName DB "SPLWND2",0 ;¹Ï¥Ü¦WºÙ¤Î¤@¯ë±¡§Î¤Uªº´å¼Ð¦WºÙ
szClassName DB "SimpleWndClass",0 ;µøµ¡Ãþ§O¦WºÙ
szAppName DB "²³æªºµøµ¡",0
sYouPress DB "§A«ö¤U¤F Áä¡C"
;***************************************************************************************************
.CODE
;---------------------------------------------------------------------------------------------------
WndProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.switch uMsg
.case WM_PAINT
invoke BeginPaint,hWnd,ADDR ps
invoke GetClientRect,hWnd,ADDR rect
;¨D±osYouPress¦r¦ê©Ò¦b¯x§Î¥ª¤W¨¤®y¼Ð(0,0)¡A»P¥k¤U¨¤®y¼Ð(str_rect.right,str_rect.bottom)
;¦]¦¹sYouPress¦r¦êªº°Åµô¯x§Î¼e¬°str_rect.right¡A°ª¬°str_rect.bottom
mov str_rect.left,0
mov str_rect.top,0
invoke DrawText,ps.hdc,ADDR sYouPress,SIZEOF sYouPress,ADDR str_rect,\
DT_CALCRECT or DT_SINGLELINE
;¥Ñ¤u§@°Ïªº¼e»P°ª¡A¤ÎsYouPress¦r¦êªº°Åµô¯x§Î¼e»P°ª¡A¥i¥HpºâsYouPress¦r¦êªº°Åµô¯x§Î®y¼Ð
;¥ª¤W¨¤X®y¼Ð¬°(rect.right-str_rect.right)/2¡AY®y¼Ð¬°(rect.bottom-str_rect.bottom)/2
;¥k¤U¨¤X®y¼Ð¬°(rect.right-str_rect.right)/2+str_rect.right¡AY®y¼Ð¬°
;(rect.bottom-str_rect.bottom)/2+str_rect.bottom
mov r10d,rect.right
sub r10d,str_rect.right
shr r10d,1
mov str_rect.left,r10d
add str_rect.right,r10d
mov r11d,rect.bottom
sub r11d,str_rect.bottom
shr r11d,1
mov str_rect.top,r11d
add str_rect.bottom,r11d
invoke DrawText,ps.hdc,ADDR sYouPress,SIZEOF sYouPress,ADDR rect,\
DT_SINGLELINE or DT_CENTER or DT_VCENTER
invoke EndPaint,hWnd,ADDR ps
.case WM_MOUSEMOVE
movzx r10,r9w ;R10D¡×·Æ¹«´å¼Ð©Ò¦bªºX®y¼Ð
shr r9,10h ;R9D¡×·Æ¹«´å¼Ð©Ò¦bªºY®y¼Ð
mov rdx,OFFSET szCursorName
;Àˬd·Æ¹«´å¼Ð©Ò¦bX®y¼Ð¬O§_¦bstr_rect.left»Pstr_rect.right¤§¶¡¡AY§_«h¸õÅD¦Üset_cr
cmp r10d,str_rect.left
jb set_cr
cmp r10d,str_rect.right
ja set_cr
;Àˬd·Æ¹«´å¼Ð©Ò¦bY®y¼Ð¬O§_¦bstr_rect.top»Pstr_rect.bottom¤§¶¡¡AY§_«h¸õÅD¦Üset_cr
cmp r9d,str_rect.top
jb set_cr
cmp r9d,str_rect.bottom
ja set_cr
mov rdx,TEXT_CUR
set_cr: invoke LoadCursor,hInstance,rdx
invoke SetCursor,rax
invoke ShowCursor,TRUE ;¤]¥i¥H±N³o¤@¦æ§R°£
.case WM_CHAR
mov rax,wParam
mov [sYouPress+8],al
invoke InvalidateRect,hWnd,0,1
.case WM_DESTROY
invoke PostQuitMessage,0
.default
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endsw
xor rax,rax
ret
WndProc ENDP
;---------------------------------------------------------------------------------------------------
main PROC
invoke GetModuleHandle,0 ;¨ú±o¼Ò²Õ¥N½X
mov hInstance,rax
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW
lea rdx,WndProc
mov wc.lpfnWndProc,rdx
mov wc.cbClsExtra,0
mov wc.cbWndExtra,0
mov wc.hInstance,rax
invoke LoadIcon,hInstance,OFFSET szIconName ;¨ú±o¹Ï¥Ü¥N½X
mov wc.hIcon,rax ;¦s¤J¹Ï¥Ü¥N½X
mov wc.hIconSm,rax ;¦s¤J¤p¹Ï¥Ü¥N½X
invoke LoadCursor,hInstance,OFFSET szCursorName;¨ú±o´å¼Ð¥N½X
mov wc.hCursor,rax ;¦s¤J´å¼Ð¥N½X
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,0
lea rdx,szClassName
mov wc.lpszClassName,rdx
invoke RegisterClassEx,ADDR wc ;µù¥Uµøµ¡Ãþ§O
invoke CreateWindowEx,0,ADDR szClassName,ADDR szAppName,WS_OVERLAPPEDWINDOW,\
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,hInstance,0
mov hwnd,rax
invoke ShowWindow,hwnd,SW_SHOWNORMAL
invoke UpdateWindow,hwnd
.while TRUE
invoke GetMessage,ADDR msg,0,0,0
.break .if rax==0
invoke TranslateMessage,ADDR msg
invoke DispatchMessage,ADDR msg
.endw
invoke ExitProcess,0 ;µ{¦¡µ²§ô
main ENDP
;***************************************************************************************************
END main |
©³¤U¬O SPLWND2.RC ªº¤º®e¡G
1 2 3 4
5 |
#define TEXT_CUR 5000
SPLWND2 ICON "SPLWND2.ICO"
SPLWND2 CURSOR "normal cursor.cur" /* ´å¼Ð¤£¦b¦r¦ê¤Wªº§Îª¬¡AÄ_¼C§Îª¬ªº´å¼Ð */
TEXT_CUR CURSOR "text.cur" /* ´å¼Ð¦b¦r¦ê¤Wªº§Îª¬¡A½s¿èª¬ºA§Îª¬ªº´å¼Ð */ |
¹Ï¥ÜÀɪº¨Ó·½¤jP¦³¤T¡A¦p¤U¡G
nª`·Nªº¬O¡A¹Ï¥ÜÀÉ»P´å¼ÐÀɪº¼e»P°ª¬Ûµ¥¡A¤]´N¬O¥¿¤è§Î¡A¥B¤j¦h¬O 16¡Ñ16¡B32¡Ñ32¡B48¡Ñ48¡B64¡Ñ64¡K¡Kµ¥¤j¤p¡A¦]¦¹¦bÂà´««e¡AÀ³¥Hø¹Ï³nÅé±N¿ï©wªº¹Ï¤ùµô°Å¬°¥¿¤è§Î¡AOnline-Convert ·|¦Û°Ê¨Ì¾Ú§A©Ò¿ï©wªº¤j¤p¶i¦æÂà´«¡C
´å¼ÐÀɪº¨Ó·½¡A»P¹Ï¥ÜÀÉÃþ¦ü¡A¥i¥H¦Û¦æø»s©Î¤U¸ü²{¦¨ªº¡A¤]¥i¥H¥Ñ¨ä¥L¹Ï¤ùÂà´«¦Ó¨Ó¡C
¦b SPLWND2 ©Ò¥Î¨ìªº¹Ï¥Ü¡ASPLWND2.ICO¡A¬O¤p¤ì°¸¥Ñºô¸ô¤W¤U¸ü«á¡A¸g¥Ñ Online-Convert ºô¯¸Âà´«¦Ó¨Ó¡C¨£ SPLWND2.RC ²Ä 3 ¦æ¡A¥H¡uSPLWND2¡v¦r¦ê¡A¥N´À SPLWND2.ICO ¹Ï¥ÜÀÉ¡C
SPLWND2 ©Ò¥Îªº´å¼Ð¦³¨âÓ¡A¡unormal cursor.cur¡v»P¡utext.cur¡v«h¬Oºô¸ô¤Wª½±µ¤U¸üªº¡C«eªÌ¬O¤@¯ëª¬ºA¤Uªº·Æ¹«´å¼Ð¡A¬OÄ_¼C¼Ë¤lªº´å¼Ð¡A¥H¦r¦ê¡uSPLWND2¡v¥N´À¡unormal cursor.cur¡v´å¼ÐÀÉ¡F«áªÌ¬O·í·Æ¹«´å¼Ð²¾¦Ü¦r¦ê®É¡AÅܦ¨½s¿èª¬ºAªº´å¼Ð¡A¥HÃѧO½X TEXT_CUR ¥N´À¡utext.cur¡v´å¼ÐÀÉ¡C¨£ SPLWND2.RC ²Ä 4¡ã5 ¦æ¡C¦Ó±`¼Æ TEXT_CUR ªº©w¸q¦b SPLWND2.RC ²Ä¤@¦æ¡A±N¨ä©w¸q¬° 5000¡C
§â SPLWND2.ASM¡BSPLWND2.RC¡BSPLWND2.ICO¡B¡unormal cursor.cur¡v»P text.cur ¦@¤ÓÀɮסA³£©ñ¦b¦P¤@Ó¤l¥Ø¿ý¤¤¡A¨Ò¦p¡uE:\HomePage\SOURCE\Win64\SPLWND¡v¤l¥Ø¿ý¤¤¡AµM«á¶}±Ò¡u©R¥O´£¥Ü¦r¤¸¡v¡A¿é¤J¤U±¶À¦âªº«ü¥O¡G
Microsoft Windows [ª©¥» 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\wanker>uasm [Enter] ¡÷°õ¦æ UASM.BAT §å¦¸ÀÉ¡A¬Ù¤F³\¦h¥´¦r¿é¤J¡A¨£²Ä 11 ³¹ UASM.BAT C:\Users\wanker>SET INCLUDE=C:\UASM\Include C:\Users\wanker>SET LIB=C:\UASM\lib64 C:\Users\wanker>SET PATH=C:\UASM;C:\UASM\bin64;C:\Windows\system32;C:\Windows;C: \Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Fi les (x86)\UltraEdit-32 C:\Users\wanker>E: E:\>CD E:\HOMEPAGE\SOURCE\WIN64 LINK=/SUBSYSTEM:WINDOWS /DEBUG E:\HomePage\SOURCE\Win64>cd SPLWND [Enter] ¡÷¤Á´«¦Ü SPLWND ¤l¥Ø¿ý E:\HomePage\SOURCE\Win64\SPLWND>uasm64 -win64 splwnd2.asm [Enter] ¡÷¤@¦p¬J©¹¡A²ÕĶ¤è¦¡¨ÃµL¤£¦P UASM v2.56, Oct 27 2022, Masm-compatible assembler. Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. SPLWND2.ASM: 124 lines, 3 passes, 645 ms, 0 warnings, 0 errors E:\HomePage\SOURCE\Win64\SPLWND>rc splwnd2.rc [Enter] ¡÷¦h¤F¥Î RC.EXE ½sĶ SPLWND2.RC ¸ê·½´yzÀÉ Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384 Copyright (C) Microsoft Corporation. All rights reserved. ¡÷µL¥ô¦ó°T®§¡Aªí¥Ü RC.EXE ½sĶ¦¨¥\ E:\HomePage\SOURCE\Win64\SPLWND>link splwnd2.obj splwnd2.res [Enter] ¡÷¥Î LINK.EXE §â¥ØªºÀÉ»P¸ê·½ Microsoft (R) Incremental Linker Version 14.25.28614.0 Àɳsµ²°_¨Ó¡A»s§@¥X¥i°õ¦æÀÉ Copyright (C) Microsoft Corporation. All rights reserved. /SUBSYSTEM:WINDOWS /DEBUG E:\HomePage\SOURCE\Win64\SPLWND>
¤Wz²ÕĶ¡B³sµ²ªº¹Lµ{¤¤¡A´X¥G»P¥H«e¬Û¦P¡A®t§O¦b©ó¨â³B¡G①¦h¤F¥Î RC.EXE ½sĶ SPLWND2.RC ¸ê·½´yzÀÉ¡B②³sµ²®É¦h¥[¤W SPLWND2.RES ¸ê·½ÀÉ¡A³sµ²®Éªº¥ØªºÀÉ»P¸ê·½ÀÉ¡A½Ö¥ý½Ö«á³£¥i¥H¡C§¹¦¨¤W±¨BÆJ¡A´N¯à²£¥Í SPLWND2.EXE ¥i°õ¦æÀÉ¡C¥i¥H¦b©R¥O´£¥Ü¦r¤¸¤¤¡A¿é¤J SPLWND2 °õ¦æ¥¦¡C
©³¤U¨Ó¸Ñ»¡ SPLWND2.ASM µ{¦¡©Ò¥Î¨ìªºì²z¡C
¬°¤Fn¹F¨ì·Æ¹«´å¼Ð²¾¨ì¦r¦ê¤W®É¡AÅܧó´å¼Ð§Îª¬¡A¦]¦¹nºÊµø¥]§t¦í¦r¦ê©Ò¦bªº³Ì¤p¯x§Î¡C¦pªG·Æ¹«´å¼Ð¦b³oÓ¯x§Î½d³ò¤º¡A´NÅܦ¨½s¿èª¬ºAªº´å¼Ð¡A¦¹´å¼ÐÀɦW¬O¡utext.cur¡v¡A¦b SPLWND2.ASM »P SPLWND2.RC ¤¤¡A¬Ò¥HÃѧO½X TEXT_CUR¡]TEXT_CUR ¤§È¬° 5000¡^¥N´À¡utext.cur¡vÀɦW¡C¨äµ{¦¡½X¤jP¦p¤U¡G
TEXT_CUR EQU 05000 ⁝ invoke LoadCursor,hInstance,TEXT_CUR invoke SetCursor,rax
¦pªG·Æ¹«´å¼Ð¤£¦b³oÓ¯x§Î½d³ò¤º¡A´NÅܦ¨Ä_¼C§Îª¬ªº´å¼Ð¡A¦¹´å¼ÐÀɦW¬O¡unormal cursor.cur¡v¡A¦b SPLWND2.ASM »P SPLWND2.RC ¤¤¡A¬Ò¥H¦r¦ê¡uSPLWND2¡v¥N´À´å¼ÐÀɦW¡C¨äµ{¦¡½X¤jP¦p¤U¡G
szCursorName DB "SPLWND2",0 ⁝ invoke LoadCursor,hInstance,OFFSET szCursorName invoke SetCursor,rax
¥]§t¦í¦r¦ê©Ò¦bªº³Ì¤p¯x§Î¦s©ñ¦b str_rect ÅܼƤ§¤¤¡Astr_rect ªº¸ê®ÆÃþ«¬¬O RECT µ²ºcÅé¡A¦³¥|ÓÄæ¦ì¡A¨£²Ä¤K³¹¡C¦]¦¹¯x§Î¥ª¤W¨¤ªº X ®y¼Ð»P Y ®y¼Ð¤À§O¬O str_rect.left¡Bstr_rect.top¡F¦Ó¦¹¯x§Îªº¥k¤U¨¤ X ®y¼Ð»P Y ®y¼Ð¤À§O¬O str_rect.right¡Bstr_rect.bottom¡C
·Æ¹«´å¼Ð©Ò¦b®y¼Ð¥i¥Ñ WM_MOUSEMOVE °T®§ªº lParam ¤¤±o¨ì¡A¤£¹L lParam «ê¦n¬Oµøµ¡¨ç¦¡ªº²Ä¥|ӰѼơA©Ò¥H lParam ¤§È´N¬O R9 ¼È¦s¾¹¤§È¡CR9 ªº 0¡ã15 ¦ì¤¸¬O·Æ¹«´å¼Ð©Ò¦bªº X ®y¼Ð¡A16¡ã31 ¦ì¤¸¬O Y ®y¼Ð¡CSPLWND2.ASM ªº²Ä 56¡ã57 ¦æ¦p¤U¡G
movzx r10,r9w ;R10D¡×·Æ¹«´å¼Ð©Ò¦bªºX®y¼Ð shr r9,10h ;R9D¡×·Æ¹«´å¼Ð©Ò¦bªºY®y¼Ð
¨ä§@¥Î¨Ï±o·Æ¹«´å¼Ð©Ò¦bªº X ®y¼Ð»P Y ®y¼Ð¤À§O¦s©ó R10D¡BR9D¡C
±µ¤U¨ÓÀˬd·Æ¹«´å¼Ð©Ò¦bªº®y¼Ð¬O§_¦b¥]§t¦í¦r¦êªº³Ì¤p¯x§Î¡A¤èªk¬OÀˬd R10D n¦b str_rect.left »P str_rect.right ¤§¶¡¡A¦P®É R9D ¤]n¦b str_rect.top »P str_rect.bottom ¤§¶¡¡A´Nªí¥Ü·Æ¹«´å¼Ð¦b¥]§t¦í¦r¦êªº³Ì¤p¯x§Î¤º¡A¥un¦³¤@¶µ¤£²Å¦X¡A´N¤£¦b¥]§t¦í¦r¦êªº³Ì¤p¯x§Î¤º¡C
¹ê»ÚÀˬd®É¡A¥ýÀˬd R10D ¬O§_¦b str_rect.left »P str_rect.right ¤§¶¡¡AY¤£¦b³o¨â¼Æ¤§¶¡¡Aªí¥Ü·Æ¹«´å¼Ð¤£¦b¯x§Î¤º¡A¸õÅD¦Ü set_cr: ¼Ð°O³B¡C°²¦p·Æ¹«´å¼Ð¦b³o¨â¼Æ¤§¶¡¡AÁÙn¦AÀˬd R9D ¬O§_¦b str_rect.top »P str_rect.bottom ¤§¶¡¡A¦pªG R9D ¤£¦b³o¨â¼Æ¤§¶¡¡Aªí¥Ü·Æ¹«´å¼Ð¤£¦b¯x§Î¤º¡A¸õÅD¦Ü set_cr: ¼Ð°O³B¡C¦]¦¹³Ì«á³B²z WM_MOUSEMOVE °T®§ªºµ{¦¡¬°¡G
.case WM_MOUSEMOVE movzx r10,r9w ;R10D¡×·Æ¹«´å¼Ð©Ò¦bªºX®y¼Ð shr r9,10h ;R9D¡×·Æ¹«´å¼Ð©Ò¦bªºY®y¼Ð mov rdx,OFFSET szCursorName ;Àˬd·Æ¹«´å¼Ð©Ò¦bX®y¼Ð¬O§_¦bstr_rect.left»Pstr_rect.right¤§¶¡¡AY§_«h¸õÅD¦Üset_cr cmp r10d,str_rect.left jb set_cr cmp r10d,str_rect.right ja set_cr ;Àˬd·Æ¹«´å¼Ð©Ò¦bY®y¼Ð¬O§_¦bstr_rect.top»Pstr_rect.bottom¤§¶¡¡AY§_«h¸õÅD¦Üset_cr cmp r9d,str_rect.top jb set_cr cmp r9d,str_rect.bottom ja set_cr mov rdx,TEXT_CUR set_cr: invoke LoadCursor,hInstance,rdx invoke SetCursor,rax invoke ShowCursor,TRUE ;¤]¥i¥H±N³o¤@¦æ§R°£
¤W±³o¬qµ{¦¡¡A¦bÀˬd·Æ¹«´å¼Ð¬O§_¦b¯x§Î½d³ò¤º¤§«e¡A¥ý°²³]·Æ¹«´å¼Ð¤£¦b¯x§Î½d³ò¤º¡A©Ò¥H¥ýÅý RDX «ü¦V szCursorName ¦r¦ê¡A¦¹¦r¦ê¬O¡uSPLWND2¡v¥Nªí¡unormal cursor.cur¡v¡A¤]´N¬O·Æ¹«´å¼Ð¤£¦b¦r¦ê¤W®Éªº´å¼ÐÀÉ¡Cº¸«áÀˬdµ²ªG¡A°²¦p·Æ¹«´å¼Ð½T¹ê¦b¦r¦ê¤W®É¡A¤~¨Óקï RDX ¬° 5000¡A¨Ï¨ä¬°½s¿èª¬ºA§Îª¬ªº´å¼Ð¡A¤]´N¬O¡utext.cur¡v´å¼ÐÀÉ¡C
¤W±µ{¦¡¤ù¬qªº³Ì«á¤@¦æ¡A¥i¦³¥iµL¡A¦ý¬°¤F¦h¤¶²Ð¤@Ó ShowCursor API¡A¦P®É¤]¼W¥[½g´T¡A´N¯dµÛ¤F¡C
³Ì«á¶È³Ñ¤U¤@Ó°ÝÃD¡A´N¯à¼g¥X SPLWND2.ASM ¤F¡C³oÓ°ÝÃD´N¬O¡A¦p¦ópºâ¥]§t¦í¦r¦ê©Ò¦bªº³Ì¤p¯x§Î¡C¦¹¯x§Î¦b¤u§@°Ïªº¤¤¥¡¡A¬J¬O¤ô¥¤è¦Vªº¤¤¥¡¡A¤]¬O¹]««¤è¦Vªº¤¤¥¡¡Cnpºâ³oÓ¯x§Îªº½d³ò¡A¥²¶·ª¾¹D¨â¶µ¸ê®Æ¡G
Ãö©ó²Ä 2 Ó°ÝÃD¡A¤ñ¸û¦n¸Ñ¨M¡A¥un©I¥s GetClientRect¡A´N¯à±o¨ì¤u§@°Ïªº¯x§Î½d³ò¡A¨ä¥ª¤W¨¤®y¼Ð·íµM¬O¡]0,0¡^¡A¥k¤U¨¤ªº X ®y¼Ð»P Y ®y¼Ð¨ä¹ê¤]¬O¤u§@°Ïªº¼e«×»P°ª«×¡C¨£ SPLWND2.ASM ²Ä 30 ¦æ¡A©I¥s§¹«á¡A§â¤u§@°Ïªº¤j¤p¦s©ó rect µ²ºcÅé¡A¨ä¼e«×»P°ª«×¤À§O¬O rect.right¡Brect.bottom¡C¨£¤U¹ÏⒶ¡BⒷ¡C
Ãö©ó²Ä 1 Ó°ÝÃD¡A»¡Ãø¨ä¹ê¤]¤£Ãø¡CÁÙ°O±o DrawText ¦³Ó«nªº¯S©Ê¡A¦pªG©I¥s DrawText ®É¡A³Ì«á¤@ӰѼƬ° DT_CALCRECT ®É¡A¥i¥Hpºâ¥]§t¦í¦r¦ê©Ò¦bªº³Ì¤p¯x§Î¡ADrawText ºÙ¦¹¯x§Î¬°¡u°Åµô¯x§Î¡v¡A¨£²Ä¤K³¹¡C¦¹¥~¡A¦pªGnÅã¥Üªº¦r¦ê¥u¦³¤@¦æ¡AÁÙ¥²¶·¶ñ¤W°Åµô¯x§Îªº¥ª¤W¨¤®y¼Ð¡A¦b SPLWND2 ªº²Ä 33¡ã34 ¦æ´N¬O°µ³o¥ó¨Æ¡C
¦ý¬°¦ó±N°Åµô¯x§Îªº¥ª¤W¨¤®y¼Ð³]¬°¡]0,0¡^©O¡H³o¼Ë°µªº¦n³B¬O°Åµô¯x§Î¥ª¤U¨¤ªº X ®y¼Ð»P Y ®y¼Ð«ê¦n´N¬O¥]§t¦r¦ê³Ì¤p¯x§Îªº¼e«×»P°ª«×¡C°õ¦æ§¹²Ä 35 ¦æ«á¡A¥]§t¦r¦ê³Ì¤p¯x§Îªº¼e«×»P°ª«×¡A¤À§O¦s©ó str_rect µ²ºcÅ骺 str_rect.right »P str_rect.bottom Äæ¦ì¤§¤¤¡C¨£¤U¹ÏⒸ¡BⒹ¡C
¦Ó¦¹³B°Åµô¯x§Îªº§@¥Î¡A¨Ã«Dn¦b¨ä¤ºÅã¥Ü¦r¦ê¡A¨ä¥Øªº¶È¶È¬O¨D¥X¥]§t¦r¦ê³Ì¤p¯x§Îªº¼e«×»P°ª«×¡A¦bºÊµø·Æ¹«´å¼Ð®Én¥Î¨ì¡C¦r¦ê¬OÅã¥Ü¦b¤u§@°Ïªº¤¤¥¡¡A§â³Ì«á¤@ӰѼƳ]¬°¡uDT_SINGLELINE or DT_CENTER or DT_VCENTER¡v§Y¥i¡A¨ä°Åµô¯x§Î¬O¾ãÓ¤u§@°Ï¡C
¦³¤F¡u¥]§t¦r¦ê³Ì¤p¯x§Îªº¼e«×»P°ª«×¡v¡B¥H¤Î¡u¤u§@°Ïªº¼e«×»P°ª«×¡v¨â¶µ¸ê®Æ¤§«á¡A´N¯àpºâ¥]§t¦r¦ê³Ì¤p¯x§Îªº½d³ò¤F¡C½Ð°Ñ¦Ò¤U¹Ï¡A¤u§@°Ï¥ª¤W¨¤¤Î¥k¤U¨¤®y¼Ð§¡¤wª¾¡A¦]¦¹¤u§@°Ïªº¼e«×¬O rect.right¡A¨£Ⓐ¡F¦Ó¥]§t¦r¦ê³Ì¤p¯x§Îªº¼e«×¬O str_rect.right¡A¨£Ⓒ¡C¥]§t¦r¦ê³Ì¤p¯x§Î¥ª¥k¨âÃä¦Ü¤u§@°Ï¥ª¥k¨â°¼Ãä½uªº¶ZÂ÷¬Ûµ¥¡A¦]¦¹¨ä¤j¤p¬°¡A³o¤]¬O¥]§t¦r¦ê³Ì¤p¯x§Î¥ª¤W¨¤ªº X ®y¼Ð¡Ax1 ¤§È¡A¨£¤U¹ÏⒺ¡C¦P²z y1 ¤§È¬°¡C
x2 «h¬O x1 ¦A¥[¤W¥]§t¦í¦r¦ê³Ì¤p¯x§Îªº¼e«×¡A©Ò¥H¨äȬ°¡C¦P²z y2 ¤§È¬O y1 ¦A¥[¤W¥]§t¦í¦r¦ê³Ì¤p¯x§Îªº°ª«×¡A¤]´N¬O¡C
¨ì³oùØ¡A¥]§t¦í¦r¦ê³Ì¤p¯x§Îªº¥ª¤W¨¤®y¼Ð¡A¤Î¥k¤U¨¤®y¼Ð³£¤wpºâ¥X¨Ó¡A³Ì«á¦A±N¨ä¦s©ó str_rect µ²ºcÅ餺¡A¨£ SPLWND2.ASM ²Ä 37¡ã50 ¦æ¡C¦¹µ²ºcÅé´N¬O¦b WM_MOUSEMOVE °T®§®É¡AnºÊµøªº¯x§Î°Ï°ì¡A¦pªG·Æ¹«´å¼Ð¦b¦¹¯x§Î½d³ò¤º¡A´N§ó§ï·Æ¹«´å¼Ð¡A¦¨¬°½s¿èª¬ºAªº´å¼Ð¡C