¦b¤W¤@³¹¡A¤p¤ì°¸»¡©ú¤F§Q¥Îp®É¾¹µo¥Xªº°T®§¡]¤]´N¬O WM_TIMER °T®§¡^¡A¦b¸Ë¸m¤º®e¡]device context¡^¤Wø»s¹Ï§Î¡C¦b³o¤@³¹ùØ¡A±N¤¶²Ð¨Ï¥ÎªÌ¥H·Æ¹«¡A¦b¸Ë¸m¤º®e¤Wø»s¹Ï§Î¡A¨ÃÁ|¨âÓ¨Ò¤l¡C¥ýn»¡©úªº¬O·Æ¹«°T®§¡C
¦³¨Ç·Æ¹«¤W±¦³¤TÓ«öÁä¡A¥Ñ¥ª¦Ó¥k¤À§OºÙ¬°¡u·Æ¹«¥ªÁä¡v¡B¡u·Æ¹«¤¤Áä¡v»P¡u·Æ¹«¥kÁä¡v¡C·í·Æ¹«´å¼Ð¦bµøµ¡ªº¤u§@°Ï¡]client area¡^¤º¡A¦pªG¨Ï¥ÎªÌ«ö¤U·Æ¹«¥ªÁä¡AWindows ·|¹ï¸Óµøµ¡µo¥X WM_LBUTTONDOWN °T®§¡F·í¨Ï¥ÎªÌÃP¶}·Æ¹«¥ªÁä®É¡A«hµo¥X WM_LBUTTONUP °T®§¡C
¹³¤W±³o¼Ë«ö¤U·Æ¹«¥ªÁä¡A¥ß§YÃP¶}ªº°Ê§@¡AºÙ¤§¬°ÂIÀ»¡]click¡^¡A¤@¯ë¥Î©ó¦b®à±¤W¿ï¾Üþ¤@Óµøµ¡¡A©Î¬O¦bµøµ¡¤¤¿ï¾Ü¬YÓ¶µ¥Ø¡C·í¨Ï¥ÎªÌ§¹¦¨¤@¦¸ÂIÀ»¡A¨t²Î·|µo¥X¨â«h°T®§¡AWM_LBUTTONDOWN »P WM_LBUTTONUP¡C¤@¯ë¦Ó¨¥¡AÀ³¥Îµ{¦¡¥u»Ý³B²z WM_LBUTTONDOWN §Y¥i¡C
·í¨Ï¥ÎªÌ«ö¤U¤ÎÃP¶}·Æ¹«¤¤Áä®É¡A¤À§Oµo¥X WM_MBUTTONDOWN ¥H¤Î WM_MBUTTONUP¡F·í¨Ï¥ÎªÌ«ö¤U¤ÎÃP¶}·Æ¹«¥kÁä®É¡A¤À§Oµo¥X WM_RBUTTONDOWN ¥H¤Î WM_RBUTTONUP¡C·í¨Ï¥ÎªÌ«ö¤U·Æ¹«¥kÁä¡A¦AÃP¶}ªº°Ê§@¡A¤@¯ë¤£ºÙ¬°ÂIÀ»¡A°£«D¨Ï¥ÎªÌ¬O¥ªºJ¤l¡A¨Ã¥B¤w³]©w·Æ¹«¥ª¥kÁä¥æ´«¡C
¥H¤W³o¤»Ó°T®§¤¤©Òªþ±aªº wParam ¸ê®Æ³£¤@¼Ë¡Aªí©ú·í«ö¤U·Æ¹«¤Wªº«öÁä®É¡A¬O§_¦³«ö¤U·Æ¹«¤Wªº¨ä¥L«öÁä©ÎÁä½L¤Wªº«öÁä¡C¨£¤Uªí¡G
wParam | ¼ÆÈ | »¡©ú |
MK_CONTROL | 8 | Áä½L¤Wªº Ctrl Áä³Q«ö¤U |
MK_LBUTTON | 1 | ·Æ¹«¥ªÁä³Q«ö¤U |
MK_MBUTTON | 16 | ·Æ¹«¤¤Áä³Q«ö¤U |
MK_RBUTTON | 2 | ·Æ¹«¥kÁä³Q«ö¤U |
MK_SHIFT | 4 | Áä½L¤Wªº Shift Áä³Q«ö¤U |
MK_XBUTTON1 | 32 | ²Ä¤@ӷƹ«©µ¦ùªº«öÁä³Q«ö¤U |
MK_XBUTTON2 | 64 | ²Ä¤Gӷƹ«©µ¦ùªº«öÁä³Q«ö¤U |
¦Ó³o¤»«h°T®§©Òªþ±aªº lParam ¸ê®Æ¡A«h¬Oµo¥Í¸Ó°T®§®É¡A·Æ¹«´å¼Ð©Ò¦bªº®y¼Ð¡A¦¹®y¼Ð¬O¥H¤u§@°Ï¥ª¤W¨¤¬°ìÂI¡CX ®y¼Ð¬O¦b lParam ªº²Ä 0¡ã15 ¦ì¤¸¡AY ®y¼Ð«h¦b 16¡ã31 ¦ì¤¸¡C¦¹¥~¡AlParam ¤ºªº®y¼ÐìÂI¬O¦b¤u§@°Ïªº¥ª¤W¨¤¡C³oºØ¬Û¹ï©ó¤u§@°Ï¥ª¤W¨¤¬°ìÂIªº®y¼Ð¡AºÙ¬°¤u§@°Ï®y¼Ð¡]client-area coordinates¡^¡FÁÙ¦³¤@ºØ¬O¬Û¹ï©ó¿Ã¹õ¥ª¤W¨¤¬°ìÂIªº®y¼Ð¡AºÙ¬°¿Ã¹õ®y¼Ð¡]screen coordinates¡^¡C
¦³¨Ç·Æ¹«¨Ã¨S¦³·Æ¹«¤¤Áä¡A¦Ó¥Hºu½ü¨ú¥N¡AµM¦Ó³oºØ·Æ¹«ªººu½ü¤´µM¥i¥H©¹¤U«ö¡A«ö¤U¤§«á¤]¯àÃP¶}¡C·í¨Ï¥ÎªÌ«ö¤Uºu½ü¡A¤@¼Ë·|µo¥X WM_MBUTTONDOWN °T®§¡AÃP¶}ºu½ü¤]·|µo¥X WM_MBUTTONUP °T®§¡C
¨ã¦³ºu½üªº·Æ¹«¡A¤£¦ý¯àÅý¨Ï¥ÎªÌ¹³·Æ¹«¤¤Áä¤@¼Ë¡A«ö¤U©ÎÃP¶}ºu½ü¡A¤]¯àÅý¨Ï¥ÎªÌºu°Êºu½ü¡C·í¨Ï¥ÎªÌºu°Ê·Æ¹«ºu½ü®É¡A¨t²Î·|§â WM_MOUSEWHEEL °T®§µo°eµ¹¨ã¦³¿é¤JµJÂIªºµøµ¡¡A¦Ó¤£¬O·Æ¹«´å¼Ð¤U¤èªºµøµ¡¡A¥H¤W©Ò´yzªº¬O MSDN ¥H¤Îºô»Úºô¸ô¤W©Ò¯à¬d¨ì¤j³¡¤Àªº¤åÄm¤W©Ò°O¸üªº¡F¦ý¬O¦pªG¯uªº¥h°µ¹êÅç¡A¦b Windows 7 SP1/8/10/11 µ¥¸û·sªº§@·~¨t²Î¤W¡A¨º»ò¨t²Î·|§â WM_MOUSEWHEEL °T®§µo°eµ¹·Æ¹«´å¼Ð¤U¤èªºµøµ¡¡C
¿é¤JµJÂI¡]input focus¡^¤]®É¤]ºÙÁä½LµJÂI¡]keyboard focus¡^¬O«ü¦b§@·~¨t²Îªº®à±¤W²³¦hµøµ¡¤¤¡A¯à°÷±µ¦¬Áä½L¿é¤Jªº±±¨î¶µ©Îµøµ¡¡C·í¬YÓ±±¨î¶µ©Îµøµ¡¨ã¦³¿é¤JµJÂI®É¡A¨Ï¥ÎªÌ¦bÁä½L©Ò¥´ªº¦r·|ª½±µ¿é¤J¨ì¸Ó±±¨î¶µ©Îµøµ¡¡A¦Ó¨ä¥L±±¨î¶µ©Îµøµ¡«h¤£·|±µ¦¬Áä½L¿é¤J¡CÄҨϥΪ̥H·Æ¹«¥ªÁäÂIÀ»¬YÓµøµ¡©Î±±¨î¶µ¡B¨Ï¥Î¥[³tÁä©Î©I¥s SetFocus API ³£¯àÅý¸Óµøµ¡©Î±±¨î¶µ±o¨ì¿é¤JµJÂI¡C
WM_MOUSEWHEEL °T®§©Òªþ±aªº wParam ¸ê®Æ¡A¨ä¤¤ªº 0¡ã15 ¦ì¤¸ªí©ú·íºu°Êºu½ü®É¡A¬O§_¦³«ö¤U·Æ¹«¤Wªº«öÁä©ÎÁä½L¤Wªº«öÁä¡A¨ä·N¸q»P¤Wªí¬Û¦P¡CWM_MOUSEWHELL °T®§©Òªþ±a wParam ªº¸ê®Æ¤¤¡A¦b¨ä¤¤²Ä 16¡ã31 ¦ì¤¸©Òªí¥Üªº 16 ¦ì¤¸¼ÆÈ¡A«ü¥Ü¤F¨Ï¥ÎªÌÅý·Æ¹«ºu½üºu°Ê¤F¦h¤Ö¶ZÂ÷¡C¦¹ 16 ¦ì¤¸¼ÆÈ¥i¯à¬O¥¿È¡A¤]¥i¯à¬OtÈ¡C¥¿È¥Nªí¨Ï¥ÎªÌ©¹«eºu°Ê·Æ¹«ºu½ü¡Aºu½ü³Ì¤W¤èªº¨º¤@ÂI»·Â÷¨Ï¥ÎªÌ¡Aµ{¦¡À³Åý¨Ï¥ÎªÌ¬Ý¨£¥ý«eªº¸ê®Æ¡FtÈ«hªí¥Ü»P«ez¤è¦V¬Û¤Ï¡Aµ{¦¡À³Åý¨Ï¥ÎªÌ¯à¬Ý¨£¸û«á±ªº¸ê®Æ¡C
¤Wz 16 ¦ì¤¸¼ÆȪºµ´¹ïÈ¥Nªí¨Ï¥ÎªÌÅý·Æ¹«ºu½ü¤F¦h¤Ö¶ZÂ÷¡A¦¹¶ZÂ÷¬O WHEEL_DELTA ªº¿¼Æ¡CWHEEL_DELTA ¤§È¬° 120¡A·Æ¹«ºu½üºu°Êªº¶ZÂ÷°£¥H WHEEL_DELTA ´N¯àºâ¥X±²°Ê¤F¦h¤Ö®æ¡C¤j³¡¤Àªºµ{¦¡³]©w¬OÂà°Êºu½ü¤@®æ¡A¤u§@°Ïªº¤º®en±²°Ê¤T¦C¤å¦r¡C
WM_MOUSEWHEEL °T®§ªþ±aªº lParam ¸ê®Æ«h¬Oµo¥Í¸Ó°T®§®É¡A·Æ¹«´å¼Ð©Ò¦bªº®y¼Ð¡CX ®y¼Ð¬O¦b lParam ªº²Ä 0¡ã15 ¦ì¤¸¡AY ®y¼Ð«h¦b 16¡ã31 ¦ì¤¸¡C¦ý¬O¦¹®y¼Ð¬O¿Ã¹õ®y¼Ð¡A¨äìÂI¬O¦b¿Ã¹õªº¥ª¤W¨¤¡A¸ò WM_LBUTTONDOWN µ¥°T®§ªº®y¼ÐìÂI¤£¦P¡C
·í¨Ï¥ÎªÌ§Ö³t¦a«ö¤U·Æ¹«¥ªÁä¡BÃP¶}¡AµM«á¦A§Ö³t¦a«ö¤U¡BÃP¶}¡A¨t²Î´N·|§â WM_LBUTTONDBLCLK °T®§µo°eµ¹·Æ¹«´å¼Ð¤U¤èªºµøµ¡¡C¹³³oºØ§Ö³tªº³sÄòÂIÀ»·Æ¹««öÁä¨â¦¸¡AºÙ¬°ÂùÀ»¡]double click¡^¡C¨Ï¥ÎªÌ¤]¥i¥H¥Î·Æ¹«¤¤Áä©Î·Æ¹«¥kÁäÂùÀ»µøµ¡¡A¨t²Î·|¤À§Oµo¥X WM_MBUTTONDBLCLK »P WM_RBUTTONDBLCLK °T®§¡C¦ý¬O¡Anª`·Nªº¬O¡A¦pªGµøµ¡n¦¬¨ì WM_LBUTTONDBLCLK¡BWM_MBUTTONDBLCLK ©Î WM_RBUTTONDBLCLK °T®§¡A¦¹µøµ¡¥²¶·¨ã¦³ CS_DBLCLKS ·®æ¤~¦æ¡C¥i¥H¦bµù¥Uµøµ¡Ãþ§O®É¡A§â WNDCLASSEX µ²ºcÅ骺 style Äæ¦ì¥[¤W CS_DBLCLKS §Y¥i¡C
¥t¥~¡A·í¨Ï¥ÎªÌ¥H·Æ¹«¥ªÁäÂùÀ»¬YÓª«Åé®É¡A¹ê»Ú¤W¨t²Î¨Ì§Çµo¥X WM_LBUTTONDOWN¡BWM_LBUTTONUP¡BWM_LBUTTONDBLCLK »P WM_LBUTTONUP ¥|«h°T®§¡AWM_LBUTTONDBLCLK ¬O¨ä¤¤ªº²Ä¤T«h°T®§¡A¦pªGÀ³¥Îµ{¦¡n³B²z¨Ï¥ÎªÌÂùÀ»ªº°Ê§@¡A¥u»Ý³B²z WM_LBUTTONDBLCLK °T®§§Y¥i¡C¨Ï¥ÎªÌ¥H·Æ¹«¤¤Áä¡B¥kÁä¶i¦æÂùÀ»°Ê§@®É¡A¤]¤@¼ËÓ§Oµo¥X¥|«h°T®§¡C
WM_LBUTTONDBLCLK¡BWM_MBUTTONDBLCLK »P WM_RBUTTONDBLCLK ¤T«h°T®§¤¤©Òªþ±aªº wParam »¡©ú¤F¦bÂùÀ»®É¡A¬O§_¦³¨ä¥L«öÁä«ö¤U¡A¨ä·N¸q¥i°Ñ¦Ò¡u·Æ¹«°T®§¤¤ªº wParam¡v¡C³o¤T«h°T®§ªº lParam «h¬Oµo¥ÍÂùÀ»®É¡A·Æ¹«´å¼Ð©Ò¦bªº®y¼Ð¡AlParam ªº²Ä 0¡ã15 ¦ì¤¸¡AY ®y¼Ð«h¦b 16¡ã31 ¦ì¤¸¡C¦¹®y¼ÐªºìÂI¬O¦b¤u§@°Ïªº¥ª¤W¨¤¡C
·í·Æ¹«´å¼Ð¦b¬YÓµøµ¡ªº¤u§@°Ï¤º²¾°Ê®É¡A¨t²Î·|¹ï¸Óµøµ¡µo¥X WM_MOUSEMOVE °T®§¡CWM_MOUSEMOVE °T®§ªº wParam ªí©ú·í²¾°Ê·Æ¹«´å¼ÐÁä®É¡A¬O§_¦³«ö¤U·Æ¹«¤W¨ä¥L«öÁä©ÎÁä½L¤Wªº«öÁä¡A¨ä·N¸q¸ò¤W±ªº¡u·Æ¹«°T®§¤¤ªº wParam¡vªí®æ¤@¼Ë¡C
¦Ó WM_MOUSEMOVE °T®§©Òªþ±aªº lParam ¸ê®Æ«h¬Oµo¥Í¸Ó°T®§®É¡A·Æ¹«´å¼Ð¦b¤u§@°Ï¤ºªº®y¼Ð¡CX ®y¼Ð¬O¦b lParam ªº²Ä 0¡ã15 ¦ì¤¸¡AY ®y¼Ð«h¦b 16¡ã31 ¦ì¤¸¡C¦¹¥~¡AlParam ¤ºªº®y¼ÐìÂI¬O¦b¤u§@°Ïªº¥ª¤W¨¤¡C
»¡¤F³o»ò¦h·Æ¹«°T®§¡A©³¤U§Q¥Î WM_LBUTTONDOWN¡BWM_MOUSEMOVE ¨â«h°T®§¨Ó»s§@ DRAW1.ASM¡CDRAW1.ASM ¼ÒÀÀµeµ§¦b¥Õ¯È¤W§@µeªº°Ê§@¡A·í¨Ï¥ÎªÌ¥H·Æ¹«¥ªÁäÂIÀ»¤u§@°Ï¥ô¤@¦a¤è¡A´N¬Û·í©ó§âµeµ§µ§¦y±µÄ²¯È±¡FY¦¹®É²¾°Ê·Æ¹«´N¯à¦b¤u§@°Ï¤Wµe¥Xy¸ñ¨Ó¡A¬Û·í©ó¥Îµeµ§¦b¯È¤Wµe¥X½u±ø¡F¦pªGn°±¤î§@µe¡A¦A¥H·Æ¹«¥ªÁäÂIÀ»¤@¦¸¡A´N¬Û·í©ó´£°_µeµ§Â÷¶}¯È±¡C§¹¾ãªºì©lµ{¦¡¦p¤U¡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 |
OPTION CASEMAP:NONE
OPTION WIN64:3
INCLUDE WINDOWS.INC
INCLUDELIB GDI32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
;*****************************************************************************************
.DATA
hInstance DQ ? ;¼Ò²Õ¥N½X
hwnd HWND ? ;µøµ¡¥N½X
line_start POINT <> ;°_ÂI
line_end POINT <> ;²×ÂI
pen_down DQ 0 ;µeµ§ªºª¬ºA¡A0¡Ð´£°_µeµ§¡A1¡Ð©ñ¤Uµeµ§
szClassName DB "DRAW1",0
szAppName DB "¤âø¹Ï",0
;*****************************************************************************************
.CODE
;-----------------------------------------------------------------------------------------
WndProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL ps:PAINTSTRUCT,rect:RECT
.switch uMsg
.case WM_PAINT
;·ípen_down¬°¤@®É¡Aªí¥Ü©ñ¤Uµeµ§nø»s¹Ï§Î¡FY¬°0¡Aªí¥Ü´£°_µeµ§¤£Ã¸»s¹Ï§Î
invoke BeginPaint,hWnd,ADDR ps
.if pen_down==1
invoke MoveToEx,ps.hdc,line_start.x,line_start.y,0
invoke LineTo,ps.hdc,line_end.x,line_end.y
mov r10d,line_end.x
mov r11d,line_end.y
xchg line_start.x,r10d
xchg line_start.y,r11d
.endif
invoke EndPaint,hWnd,ADDR ps
.case WM_MOUSEMOVE
;·ípen_down¬°¤@®É¡Aªí¥Ü©ñ¤Uµeµ§¡Anø»s¹Ï§Î¡A¬ö¿ý·Æ¹«²¾°Êªº¦U¹³¯À®y¼Ð
.if pen_down==1
mov r8,r9
shr r9,10h
and r8,0ffffh
mov line_end.x,r8d ;§â¹³¯ÀªºX®y¼Ð¦s©óline_end.x
mov line_end.y,r9d ;§â¹³¯ÀªºX®y¼Ð¦s©óline_end.x
invoke InvalidateRect,hWnd,0,0 ;¹ï¥»¨µo¥XWM_PAINT°T®§
.endif
.case WM_LBUTTONDOWN
xor pen_down,1 ;¤Á´«µeµ§ª¬ºA¡]¦b´£°_»P©ñ¤U¤§¶¡¤Á´«¡^
.if pen_down==1
mov r8,r9
shr r9,10h
and r8,0ffffh
mov line_start.x,r8d;§â°_ÂIªºX®y¼Ð¦s©óline_start.x
mov line_start.y,r9d;§â°_ÂIªºY®y¼Ð¦s©óline_start.y
.endif
.case WM_DESTROY
quit: invoke PostQuitMessage,0
.default
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endsw
xor rax,rax
ret
WndProc ENDP
;-----------------------------------------------------------------------------------------
main PROC
LOCAL wc:WNDCLASSEX,msg:MSG
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,NULL,IDI_APPLICATION ;¨ú±o¹Ï¥Ü¥N½X
mov wc.hIcon,rax ;¦s¤J¹Ï¥Ü¥N½X
mov wc.hIconSm,rax ;¦s¤J¤p¹Ï¥Ü¥N½X
invoke LoadCursor,NULL,IDC_ARROW ;¨ú±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,\
50,50,500,375,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©R¥O´£¥Ü¦r¤¸¡v¡AµM«á¥H¤U±¤è¦¡²ÕĶ¡B³sµ²¡A¦Ó§ÚÌ©Òn¿é¤Jªº«ü¥O¡A³£¥H²HÂŦâ®Ø®Ø¦í¡G①¡G°õ¦æ¡uC:\Users\±b¸¹\UASM.BAT¡v¡C
②¡G¤Á´«¨ì DRAW1.ASM ©Ò¦b¸ê®Æ§¨¡C
③¡G¥Î¡uC:\UASM\UASM64.EXE¡v²ÕĶ¡Aª`·N¡A¨ä°Ñ¼Æ¡u-win64¡v¥²¶·¤p¼g¡C
④¡G¥H¡uC:\UASM\BIN64\LINK.EXE¡v³sµ²¡A¦pªG¨S¦³¥ô¦ó°T®§¡A´Nªí¥Ü¥¿½T³sµ²¦¨¥\¡C
°õ¦æªºµ²ªG¡A¦p¤U¹Ï¡C³o¬O¤p¤ì°¸¥H·Æ¹«©Òø»sªº¹Ï§Î¡A¨ä¹ê´N¬O¼g´XÓ¦r¡C
©³¤U¸Ñ»¡ DRAW1.ASM «nªº³¡¤À¡C
º¥ý¨Ó¬Ý DRAW1.ASM ¦p¦ó³B²z WM_LBUTTONDOWN °T®§¡C¨ä¹ê³o¬O DRAW1.ASM ¤¤³Ì²³æªº¹Lµ{¡A¨£ DRAW1.ASM ²Ä 47¡ã55 ¦æ¡C¦b³B²z WM_LBUTTONDOWN °T®§²Ä¤@¹D«ü¥O¬O¡uXOR pen_down,1¡v¡A³o¹D«ü¥O·|Åý¨Ï¥ÎªÌ¨C¥Î·Æ¹«¥ªÁäÂIÀ»¤@¦¸®É¡A¨Ï pen_down ¦b 0 »P 1 ¤§¶¡¤Á´«¡C³o¬O XOR ¹Bºâªº¯S©Ê¤§¤@¡A¡u¬Y¼Æ»P¦P¤@¼Æ³s°µ¨â¦¸ XOR ¹Bºâ¤´±o¨ìì¼Æ¡v¡]¨£²Ä¤@³¹ x86 «ü¥O¡GXOR¡^¡C
·í DRAW1 è¶}©l°õ¦æ®É¡Apen_down ¬°¹s¡Aªí¥Üµeµ§¥¼±µÄ²¯È±i¡C·í¨Ï¥ÎªÌÂIÀ»·Æ¹«¥ªÁä®É¡A¨t²Îµo°e WM_LBUTTONDOWN ¨ìµøµ¡¨ç¦¡¡A´N·|°õ¦æ¨ì¡uXOR pen_down,1¡v¡A©ó¬O pen_down Åܬ° 1¡C·í¨Ï¥ÎªÌ¦A¦¸ÂIÀ»·Æ¹«¥ªÁä®É¡A¤@¼Ë·|°õ¦æµøµ¡¨ç¦¡¤¤ªº¡uXOR pen_down,1¡v¡A©ó¬O pen_down ¤S«ì´_¬° 0¡AÅܦ¨ DRAW1 ·í¶}©l°õ¦æ®Éªºª¬ºA¡C¦p¦¹¤@ª½«½Æ¤£¤w¡C
·í pen_down ¬° 1 ®É¡Aªí¥Ü¶}©ln¥Îµeµ§§@¹Ï¤F¡A©Ò¥Hn°O¿ý¦¹®É·Æ¹«´å¼Ð®y¼Ð¡A§@¬°½u¬qªº°_ÂI¡A³o¬qµ{¦¡½X¦b²Ä 50¡ã54 ¦æ¡F¦pªG pen_down ¬° 0¡A¨º´N¤°»ò³£¤£¥²°µ¡Aª½±µªð¦^¡C
·í pen_down ¬° 0 ®É¡A¨ä¹ê¤£»Ý°µ¥ô¦ó³B²z¡A¥u¦³·í pen_down ¬° 1 ®É¡A¤~nµe¥Xª½½u¨Ó¡A¦]¦¹³B²z WM_MOUSEMOVE °T®§®É¡A¥Î .if/.endif ¨Ó§PÂ_¬O§_n³B²z¡A¨£²Ä 37¡ã38 ¦æ¡C·í pen_down ¬° 1 ®É¡A§â WM_MOUSEMOVE °T®§¤¤ªº·Æ¹«®y¼Ð°O¿ý°_¨Ó¡A·í°µª½½uªº²×ÂI¡CµM«á´N¬O©I¥s InvalidateRect¡A¨Ï¤u§@°ÏÅܬ°µL®Ä¡A¥H±j¢¨t²Îµo¥X WM_PAINT °T®§¡A«·sø»s¤u§@°Ï¡C
¦b³B²z WM_PAINT °T®§¤¤¡A·í pen_down ¬° 0¡A¤£¶·Ã¸»s¹Ï§Î¡A¦ýÁÙ¬On©I¥s BeginPaint »P EndPaint¡A¥HÅýµL®Ä°ÏÅܦ¨¦³®Ä°Ï¡C
·í pen_down ¬° 1 ®É¡An°µªº¨Æ±¡¨Ì§Ç¬O¡G
nø»s½u¬q¡A¤@¯ë¬O©I¥s LineTo §â·í«eªº¹³¯À»P LineTo ªº²Ä¤G¡B¤TӰѼƩҫü©wªº¹³¯À³s±µ°_¨Ó¡C·í¨Ï¥ÎªÌ²Ä¤@¦¸¥H·Æ¹«¥ªÁäÂIÀ»¤u§@°Ï®É¡A³QÂIÀ»¨ìªº¹³¯À´N¬O½u¬q°_ÂI¡A¥i©I¥s MoveToEx ±N·í«e¹³¯ÀÅܬ°³QÂIÀ»¨ìªº¹³¯À¡A³o¼Ë½u¬qªº°_ÂI´N·|¸¨¦b³QÂIÀ»¨ìªº¹³¯À¡C©I¥s MoveToEx ®É²Ä¤G¡B¤TӰѼƳ]¬°¨Ï¥ÎªÌ¥H·Æ¹«¥ªÁäÂIÀ»®Éªº®y¼Ð¡A¦Ó¸Ó®y¼Ð´N¬O WM_LBUTTONDOWN °T®§®É©Ò°O¿ýªº·Æ¹«´å¼Ð®y¼Ð¡C¨£µ{¦¡²Ä 27 ¦æ¡C
©I¥s LineTo ®É¡A²Ä¤G¡B¤TӰѼƩҫü©wªº¹³¯À¡A«h¬O·í¨Ï¥ÎªÌ²¾°Ê·Æ¹«´å¼Ð®É©Ò¨ì¹Fªº¹³¯À¡A¨ä®y¼Ð¤]´N¬O¦b³B²z WM_MOUSEMOVE °T®§®É©Ò°O¿ýªº·Æ¹«´å¼Ð®y¼Ð¡C¨£µ{¦¡²Ä 28 ¦æ¡C
µM¦Ó¡A¤j³¡¤Àªº®ÉÔ¡A¨Ï¥ÎªÌ²¾°Ê·Æ¹«´å¼Ð®É¡A·|³sÄò²£¥Í³\¦h«h WM_MOUSEMOVE °T®§¡Cnø»s¥X·Æ¹«´å¼Ðªºy¸ñ¡A¥²¶·Åý«e¦¸½u¬qªº²×ÂIÅܦ¨³o¦¸ªº°_ÂI¡C²Ä 29¡ã32 ¦æ´N¬O¦b°µ³o¥ó¨Æ±¡¡A³o¥|¦æ§âì¥ý½u¬qªº²×ÂI¡A«O¦s©ó¤U¦¸½u¬qªº°_ÂI¡C²Ä 31¡B32 ¦æ¤]¥i¥H§ï¥Î MOV «ü¥O¡A¤p¤ì°¸¥Î XCHG «ü¥O¥u¬O¼Ð·s¥ß²§¡A¨S¦³¤°»ò¯S§Oªº²z¥Ñ¡C
·í¤U¤@«h WM_MOUSEMOVE °T®§¶i¨Ó®É¡A¥ý©I¥s MoveToEx ³]¸m·í«e¹³¯À¡A¦¹·í«e¹³¯À´N¬O«e¦¸½u¬qªº²×ÂI¡C±µµÛ©I¥s LineTo ø»s½u¬q¡A¦Ó LineTo ªº²Ä¤G¡B¤TӰѼƫh¥Ñ¦b³B²z WM_MOUSEMOVE °T®§´N³B²z¦n¤F¡C§A·|µo²{¡A³o¬q³]¸m·í«e¹³¯À¡A¨ìø»s½u¬q¡A»P¤Wz¨BÆJ«½Æ¡A¦]¦¹±q²Ä 23 ¦æ¨ì²Ä 55 ¦æ´N¯àµe¥X·Æ¹«²¾°Êªºy¸ñ¡C
¦b²Ä¤Q³¹®É¡A´¿¸g¤¶²Ð¹L±²°Ê¶b¡C¨º®É±²°Ê¤u§@°Ïªº¤º®e¡A¥u¯à¥Î·Æ¹«¦b±²°Ê¶b¤WÂIÀ»±²°Ê½bÀY©Î±²°Êy¹D¡A©ÎªÌ¬O©ì©Ô±²°Ê¤è¶ô¡C¦ýµLªk¥Î·Æ¹«ºu½ü±²°Ê¡A¦ý³o¤@¤Á´Nn§ïÆ[¤F¡C¦b´£¹L WM_MOUSEWHEEL °T®§ªº¬ÛÃö¸ê®Æ¤§«á¡A´N¯à±N³B²z WM_MOUSEWHEEL °T®§ªºµ{¦¡½X´¡¤Jµøµ¡¨ç¦¡¤§¤¤¡A³o¼Ë´N¯àÅý¨Ï¥ÎªÌ¾ÞÁa·Æ¹«ºu½ü¡A±²°Ê¤u§@°Ïªº¤º®e¤F¡C
¥[¤W¥H·Æ¹«ºu½ü±²°Ê¥\¯àªºµ{¦¡ºÙ¬° SYSMTR3.ASM¡A©³¤U¥u¦C¥X¸û«n¥B»P SYSMTR2.ASM ¤£¦P¤§³B¡A§¹¾ãªºµ{¦¡½X«ö³oùؤU¸ü¡C
1 2 3 4
5 6 7 ⁝
13 14 15 16
17 18 ⁝
30 31 32
33 ⁝ 167 168
169 170 171 172
173 174 175 176
177 178 179 180
181 ⁝ 272 |
OPTION CASEMAP:NONE
OPTION WIN64:3
INCLUDE WINDOWS.INC
INCLUDELIB GDI32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
⁝
INCLUDE SYSMTR.INC
;*****************************************************************************************
.CONST
szClassName DB "SystemMetrics",0 ;µøµ¡Ãþ§O¦WºÙ
szAppName DB "Display System Metrics 3",0
szDecFmt DB "%d",0
⁝
;*****************************************************************************************
.CODE
;-----------------------------------------------------------------------------------------
WndProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
⁝
.case WM_MOUSEWHEEL
mov stsi.fMask,SIF_ALL
invoke GetScrollInfo,hWnd,SB_VERT,ADDR stsi
mov rax,wParam
shr rax,10h ;AX¡×ºu½üºu°Ê¤F¦h¤Ö¶ZÂ÷
mov r10b,WHEEL_DELTA
idiv r10b ;¦³¸¹¼Æ°£ªkAX¡ÒR10Bpºâ§¹«á¡AAL¡×°Ó¡×ºu½üºu°Ê¤F¦h¤Ö®æ
movsx r11d,al ;AL¡×°Ó¡A¤]µ¥©óºu½üºu°Ê¤F¦h¤Ö®æ
movsx r10d,al
shl r11d,1 ;R11D¡×AL¡Ñ2
add r10d,r11d ;R10D¡×AL¡Ñ2¡ÏAL¡×3¡ÑAL¡A¨Cºu°Ê¤@®æ¡A±²°Ê¤T¦C
sub stsi.nPos,r10d
mov stsi.fMask,SIF_POS
invoke SetScrollInfo,hWnd,SB_VERT,ADDR stsi,1
invoke InvalidateRect,hWnd,0,1
⁝
END main |
SYSMTR3.ASM ¬O¥H UASM ·f°t WinInc ²ÕĶ¡A¦]¦¹°£¤F¥[¤J³B²z WM_MOUSEWHEEL °T®§ªºµ{¦¡½X¤§¥~¡AÁÙ»P SYSMTR2 ¦³¨Ç³\¤£¦P¡G
©³¤U¨Ó»¡»¡ SYSMTR3.ASM ªº«¶bÀ¸¡A¦p¦ó³B²z WM_MOUSEWHEEL °T®§¡Cµ{¦¡²Ä 168¡ã169 ¦æ¡AŪ¨ú««ª½±²°Ê¶b¸ê®Æ¦s©ñ©ó stsi µ²ºcÅ餤¡A¨ä¤¤³Ì«nªº¸ê®Æ¬O±²°Ê¤è¶ôªº¦ì¸m¡A³o¶µ¸ê®Æ¦s©ó stsi.nPos¡C·í¨Ï¥ÎªÌºu°Ê·Æ¹«ºu½ü®É¡A´N±o§ïÅÜ stsi.nPos Äæ¦ì¤§È¡C
·í·Æ¹«ºu½üºu°Ê®É¡A¨t²Î·|µo°e WM_MOUSEWHEEL °T®§µ¹µøµ¡¨ç¦¡¡A¨ä¤¤©Òªþ±a wParam ¤¤ªº²Ä 16¡ã31 ¦ì¤¸¡A¥Nªí·Æ¹«ºu½üºu°Êªº¶ZÂ÷¡CSYSMTR3.ASM ¤¤ªº²Ä 170¡ã171 ¦æ®i¥Ü¤FÀò±o¦¹ 16 ¦ì¤¸ºu½üºu°Ê¶ZÂ÷ªº¤èªk¡A¨Ã±N¦¹¼ÆȦs©ó AX ¤¤¡C±µ¤U¨Óªº²Ä 172¡ã173 ¦æ¡A±N AX °£¥H WHEEL_DELTA¡A¥HÀò±oºu½üÂà°Ê¦h¤Ö®æ¡C¦]¬° WHEEL_DELTA ¬O 120¡A¥H 8 ¦ì¤¸ªí¥Ü§Y¥i¡F¦A¥[¤W·Æ¹«ºu½üºu°Êªº¶ZÂ÷¬O 16 ¦ì¤¸ªº¦³¸¹¼Æ¡A©Ò¥Hn¨Ï¥Î¤K¦ì¤¸¦³¸¹¼Æ°£ªk«ü¥O¡C©³¤U¥ý¤¶²Ð³oÓ¥¼¤¶²Ð¹Lªº«ü¥O¡AIDIV¡C
IDIV ¬O x86 ªº¦³¸¹¼Æ°£ªk«ü¥O¡C¨Æ¹ê¤W¡Ax86 ªº°£ªk«ü¥O¦³¨âºØ¡A¤À§O¬O①DIV¡B②IDIV¡C¥¦Ìªº»yªk¬Û¦P¡Aì²z¤]Ãþ¦ü¡A®t§O¦b©ó DIV ¥u¯àpºâ¥¿¾ã¼Æªº°£ªk¡A¤]´N¬OµL¸¹¼Æªº°£ªk¡FIDIV ¥i¥Hpºâ¦³¸¹¼Æªº°£ªk¡CDIV ªº¥Îªk½Ð°Ñ¾\¡uWin64 ²Õ¦X»y¨¥²Ä¥|³¹¡v¡A¦¹³B¶È¤¶²Ð IDIV¡CIDIV ªº»yªk¦p¤U¡G
IDIV ¹Bºâ¤¸
³oùتº¹Bºâ¤¸¨ä¹ê¬O°£¼Æ¡A¥i¥H¬OÅܼƩμȦs¾¹¡A¤£¯à¬O±`¼Æ¡A¦Ó¨äªø«×¥i¥H¬O¤K¦ì¤¸¡B¤Q¤»¦ì¤¸¡B¤T¤Q¤G¦ì¤¸©Î¤»¤Q¥|¦ì¤¸¡C°£ªk¹Bºâ·íµM¦³³Q°£¼Æ¡A³Q°£¼Æ¨Ì·Ó°£¼Æªºªø«×¡A¨Ì§Ç©ñ¦b AX¡BDX:AX¡BEDX:EAX¡BRDX:RAX ùر¡Cx86 CPU ªº°£ªk¹Bºâ¡A³Q°£¼Æ¬O¨S¦³¼g¥X¨Óªº¡A¥u¼g¥X°£¼Æ¡C¦Ü©ó¹Bºâ¤§«á©Ò±oªº°Ó¥H¤Î¾l¼Æ¦s©ñ©ó¦ó³B¡A¤]²¤¦³¤£¦P¡A¦C©ó¤Uªí¡G
°£ªk¤è¦¡ | °£¼Æ | ³Q°£¼Æ | °Ó¼Æ | ¾l¼Æ | ½d¨Ò | ||
¹Bºâ«e | ¹Bºâ«á | ||||||
¤K¦ì¤¸°£ªk | 8 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | AX | AL | AH | ;¡Ð11¡Ò4¡×¡Ð2⋯⋯¡Ð3 MOV AX,0FFF5H MOV CL,4 IDIV CL |
AL=0FEH¡]°Ó¡^ AH¡×0FDH¡]¾l¼Æ¡^ CL=4 | |
¤Q¤»¦ì¤¸°£ªk | 16 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | DX:AX | AX | DX | ;11¡Ò¡]¡Ð4¡^¡×¡Ð2⋯⋯3 MOV DX,0 MOV AX,0BH MOV CX,-4 IDIV CX | AX=0FFFE¡]°Ó¡^ DX=3¡]¾l¼Æ¡^ CX=¡Ð4=0FFFCH | |
¤T¤Q¤G¦ì¤¸°£ªk ¥u¯à¥Î©ó 386µ¥¯Å¥H¤W | 32 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | EDX:EAX | EAX | EDX | ;¡Ð11¡Ò¡]¡Ð4¡^¡×2⋯⋯¡Ð3 MOV EDX,0FFFFFFFFH MOV EAX,0FFFFFFF5H MOV ECX,0FFFFFFFCH IDIV ECX | EAX=2¡]°Ó¡^ EDX=0FFFFFFFDH¡]¾l¼Æ¡^ ECX=0FFFFFFFCH | |
¤»¤Q¥|¦ì¤¸°£ªk ¥u¯à¥Î©ó x64µ¥¯Å¥H¤W | 64 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | RDX:RAX | RAX | RDX | ;1CDEFAB1234567890H¡Ò10000000H ;¡×1CDEFAB123H⋯⋯4567890H MOV RDX,1 MOV RAX,0CDEFAB1234567890H MOV RCX,10000000H DIV RCX |
RAX=1CDEFAB123H¡]°Ó¡^ RDX=4567890H¡]¾l¼Æ¡^ |
¦³¸¹¼Æªºªí¥Ü¤è¦¡¡A½Ð°Ñ¦Ò²Ä¤E³¹¡A³oùØ»¡©ú¤Wªí¤¤ªº½d¨Ò¡C¥H¤K¦ì¤¸ªº°£ªk¬°¨Ò¡A¦pªGnpºâ¡u¡Ð11¡Ò4¡×¡Ð2⋯⋯¡Ð3¡v¡A¨º»òn§â AX ³]¬°¡Ð11¡A¥i¥Hª½±µ¦bì©lµ{¦¡¤¤¿é¤J¡uMOV AX,¡Ð11¡v¡A¡uMOV AX,¡Ð0BH¡v©Î¡uMOV AX,0FFF5H¡v¡A¤TªÌ§¡¥i¡C·í¶i¦æ¨ì¡uIDIV CL¡v®É¡ACPU ·|¦Û¦æ±N°Ó¡B¾l¼Æ¤À§O¦s¤J AL¡BAH ¤¤¡C
¤£½×¬OµL¸¹¼Æ©Î¦³¸¹¼Æ¡A¶i¦æ°£ªk¹Bºâ¡A³£¯à¬Ý¦¨³sÄòªº´îªk¹Bºâ¡A¦¹³B©Ò»¡ªº´îªk¬O´î¤Ö³Q°£¼Æ»P¹sªº¶ZÂ÷¡C¥Ñ³Q°£¼Æ¶}©l¨C¦¸©¹¹sªº¤è¦V²¾°Ê¤@Ó°£¼Æ¡Aª½¨ì³Ì±µªñ¹s¥B¤£¶V¹L¹s¬°¤î¡C¨Ò¦p¥H ¡Ð11 °£¥H 4 ¬°¨Ò¡A¡Ð11 Â÷¹s¦³¤Q¤@®æªº¶ZÂ÷¡A¦]¬°°£¥H¥|¡A©Ò¥H¨C¦¸¦V¹s²¾¥|®æ¡A¥u¯à²¾¨â¦¸¡A²Ä¤T¦¸´N·|¶V¹L¹s¤F¡C²¾°Ê´X¦¸´N¬O°Ó¡A¦Ó¶ZÂ÷¹sÁٳѦh»·´N¬O¾l¼Æ¡C¦]¦¹ ¡Ð11 °£¥H 4 ±o ¡Ð2 ¾l ¡Ð3¡]¡Ð2¡B¡Ð3 ¥H¤K¦ì¤¸ªº¤Q¤»¶i¦ìªí¥Ü¤À§O¬O 0FEH¡B0FDH¡^¡C¼g¦¨¼Æ¾Ç¦¡¬°¡G
¡Ð11¡×4¡Ñ¡]¡Ð2¡^¡Ï¡]¡Ð3¡^
°ò©ó¥H¤Wªº²z¥Ñ¡A¦³¸¹¼Æªº°£ªk¤£½×³Q°£¼Æ¬O¥¿¼Æ©Ît¼Æ¡A¤]¤£ºÞ°£¼Æ¬O¥¿¼ÆÁÙ¬Ot¼Æ¡A¨ä°Ó»P°£¼Æªº¼¿n¥²»P³Q°£¼Æ¦P¸¹¡A¾l¼Æ¥²»P³Q°£¼Æ¦P¸¹¡C
¸ÑÄÀ§¹ IDIV «ü¥O«á¡A¨¥Âk¥¿¶Ç¡A¦A¦^¨ì WM_MOUSEWHEEL °T®§¡C¬°¤F»¡©ú¦p¦ó³B²z WM_MOUSEWHEEL °T®§¤¤ªº wParam ¸ê®Æ¡A¥Î¤@Ó¨Ò¤l¨Ó»¡©ú¡AÀ³¸Ó¬O«Ü¦nªº¤èªk¡C°²³]¨Ï¥ÎªÌºu°Ê·Æ¹«ºu½ü¡Aµ²ªG¨Ï WM_MOUSEWHEEL ªº wParam ¤¤¡A²Ä 15¡ã31 ¦ì¤¸¤§È¬O¡Ð240¡A¤]´N¬O¤Q¤»¶i¦ìªº 0FF10H¡C°Ñ¦Ò«ez»¡©úªº WM_MOUSEWHEEL °T®§¸ê®Æ¡Aºu½üºu°Êªº¶ZÂ÷°£¥H WHEEL_DELTA ¤~¬Oºu½üºu°Êªº®æ¼Æ¡AWHEEL_DELTA ¤§È¬° 120¡A¦]¦¹¦pªGºu½üºu°Ê¶ZÂ÷¬O¡Ð240¡A¨º»òºu°Êªº®æ¼Æ´N¬O¡Ð2¡Apºâ¤è¦¡¦p¤U¡G
¡Ð240¡Ò120¡×¡Ð2
SYSMTR3.ASM ªº²Ä 172¡ã173 ¦æ¡A§Q¥Î IDIV pºâ¥Xºu½üºu°Êªº®æ¼Æ¡A¨Ã±N¥¦¦s©ó AL ¼È¦s¾¹¤¤¡C¦]¬°±²°Ê¶b¤è¶ôªº¦ì¸m¡A¤]´N¬O¦b stsi µ²ºcÅ骺 nPos Äæ¦ìªø«×¬O DWORD¡Aµ¥¤@·|¨àpºâ¥X¨Ón±²°Ê¦h¤Ö¦æ¤§«á¡A¥²¶·»P stsi.nPos §@¹Bºâ¡A©Ò¥H¦b²Ä 174¡ã175 ¦æ±Nºu°Ê®æ¼Æ¥Ñ¤K¦ì¤¸©µ¦ù¨ì 32 ¦ì¤¸ªº R10D¡BR11D ¼È¦s¾¹¤º¡C¦]¬° AL ¤º¬O¦³¸¹¼Æ¡A¦]¦¹©µ¦ù®É§Q¥Î MOVSX «ü¥O¡A±N¨ä²Å¸¹«O¯d°_¨Ó¡C
¤@¯ëµ{¦¡·|Åý¨Cºu°Ê¤@®æ¡A¤u§@°Ï¤ºªº¸ê®Æ·|±²°Ê¤T¦æ¡Aºu°Ê®æ¼Æ¦A¼¥H¤T¤~¬O±²°Ê¦h¤Ö¦æ¡C¦ý¬O x86 ªº¼ªk«ü¥O«D±`¯Ó®É¡A¥B¥u¦³²Ö¥[¾¹¤~¯à§@¬°³Q¼¼Æ¡A¥Î°_¨Ó¸j¤â¸j¸}¡A©Ò¥H¦³¨Ç¼ªk¥Î¦ì²¾«ü¥O¥N´À¡CÁ|Ó¨Ò¤l¨Ó»¡¡A¨Ò¦pn±N¬YӼơAX¡A¼¥H¤T¡A¥i¥Î 2¡ÑX¡ÏX ªí¥Ü¡A2¡ÑX ¥i¥H¥Î x86 «ü¥Oªº¡uSHL X,1¡v¥N´À¡CSYSMTR3.ASM ¤¤ªº²Ä 176¡ã177 ¦æºt¥Ü¤F³o¼Ëªº¤èªk¡C
°²¦p¨Ï¥ÎªÌºu°Ê·Æ¹«ºu½ü«á¡A¨Ïºu°Êªº¶ZÂ÷¬O¡Ð240¡A¨º»ò°õ¦æ§¹²Ä 177 ¦æªºµ{¦¡½X¤§«á¡AR10D ¼È¦s¾¹¤º¤§È¬°¡Ð6¡Aªí¥Ü¤u§@°ÏÀ³±²°Ê¡Ð6 ¦æ¡C¥¿¸¹¥Nªí¦V¤W±²°Ê¡Astsi.nPos ¤§ÈÀ³¸Ó´î¤Ö¡Ft¸¹¥Nªí¦V¤U±²°Ê¡Astsi.nPos ¤§ÈÀ³¸Ó¼W¥[¡C©Ò¥H²Ä 178 ¦æ¡A¨Ï¥Î¡uSUB stsi.nPos,R10D¡v¨Ó¹F¦¨¤Wz¥Øªº¡C¨Ï¥Î´îªk¥i¥H¨Ï±²°Ê¥¿ÈÅý stsi.nPos ´î¤Ö¡F¨Ï±²°ÊtÈÅý stsi.nPos ¼W¥[¡C
±µ¤U¨Óªº²Ä 179¡ã180 ¦æ¡A©I¥s SetScrollInfo API §¹¦¨³]©w±²°Ê¶b±²°Ê¤è¶ôªº¦ì¸m¡C²Ä 181 ¦æ¡A©I¥s InvalidateRect ±N¤u§@°Ï³]¬°µL®Ä°Ï°ì¡A¥H±j¢¨t²Î«·sø»s¤u§@°Ï¡A¦Ó¹F¦¨±²°Êªº®ÄªG¡C