¦b¤W¤@³¹¤¶²Ð¤F±j¨î¦^À³¹ï¸Ü²°¡]¤]ºÙ¬°¼Ò¦¡¹ï¸Ü²°¡^¡A¤]¤¶²Ð¤F½d¨Ò¡AMODAL1.ASM¡A¥¦¥ý«Ø¥ß¤F¤@¯ëµøµ¡¡A«ö¤U¥[³tÁ䤧«á¤~¼u¥X±j¨î¦^À³¹ï¸Ü²°¡C¦ý³o¤@³¹±N¤¶²Ð§ó²³æªº¤èªk¡A¤p¤ì°¸ºÙ¤§¬°¡u¥H¹ï¸Ü²°¬°¥Dn¤¶±ªºÀ³¥Îµ{¦¡¡v¡C
³o¤@³¹¡A¤p¤ì°¸¥´ºâ¤¶²Ð¥¦¡A°£¦¹¤§¥~·|¥ý¤¶²Ð¼Ð·Ç±±¨î¶µªº³Ì«á¤@Ó¡A±²°Ê¶b±±¨î¶µ¡C³Ì«á¥H¤@Ó§t¦³±²°Ê¶b±±¨î¶µ¹ï¸Ü²°§@¬°¥»³¹½d¨Ò¡A³oÓ½d¨Òµ{¦¡¦³¤TÓ¾î¦V±²°Ê¶b±±¨î¶µ¡A±±¨îµÛ¤Tì¦â¬õºñÂÅÃC¦âªº±j«×¡A¨Ï¥ÎªÌ²¾°Ê±²¶b¤Wªº±²°Ê¤è¶ô¦ì¸m¥i¥H½Õ¾ã¦U¦â±j®z¡A¨Ã¥B¦b¥t¤@ÓÀRºA±±¨î¶µÅã²{¥Xµ²ªG¡C
§Ú̦b²Ä¤E¡B¤Q³¹»¡©ú¹L±²°Ê¶b¡A»P¦b³o¨à¤¶²Ðªº±²°Ê¶b±±¨î¶µ¤£¤Ó¤@¼Ë¡AÁöµM¥L̪º¦æ¬°«Ü¬Û¦ü¦ýÁÙ¬O¦³¤£¦Pªº¦a¤è¡C¬°¤F°Ï¤À¡A¤p¤ì°¸ºÙ©I«eªÌ¬°¡u¼Ð·Ç±²°Ê¶b¡v¡AºÙ©I¥»³¹ªº¥D¨¤¬°¡u±²°Ê¶b±±¨î¶µ¡v¡C©³¤U¨Ó¬Ý¬Ý¥¦Ì¤§¶¡¤£¦Pªº¦a¤è¡C
¥ý¨Ó»¡»¡¼Ð·Ç±²°Ê¶b¡C¥¦¥²µM¦ì©óµøµ¡¤u§@°Ïªº¥k¤è»P¤U¤è¡AµLªk¨ì²¾¨ì§O³B¡FÁöµM¥¦¤£ÄÝ©ó¤u§@°Ïªº¤@³¡¥÷¡A¦ý«oÄÝ©óµøµ¡ªº¤@³¡¤À¡C©Ò¥H¡A¼Ð·Ç±²°Ê¶b¤£¬Oµøµ¡¡A¨S¦³µøµ¡¥N½X¡A¤]¨S¦³ÃѧO½X¡C¦A¨Ó¬Ý¬Ý±²°Ê¶b±±¨î¶µ¡C¥¦¥i¥H¦ì©ó¤u§@°Ïªº¥ô¦ó¦a¤è¡A¤]¥i¥H³]©w¦¨¥ô·N¤Ø¤o¡A¤]¥i¥H§ïÅܤؤo¡C¥¦¬Oµøµ¡ªº¤lµøµ¡¡A©Ò¥H¤]¬O¤@ºØµøµ¡¡A¨ã¦³µøµ¡¥N½X»PÃѧO½X¡C
¼Ð·Ç±²°Ê¶b»P±²°Ê¶b±±¨î¶µ¤£¤@¼Ëªº¦a¤è¡A°£¤F¤W±´yzªº¥H¥~¡AÁÙ¦³¤@¨Ç¡A¦ý¸û¬°º¾¸H¡Aµ¥µy«á¤¶²Ð±²°Ê¶b±±¨î¶µ®É·|¹J¨ì¡A¨º®ÉÔ¦A»¡¡C©³¤U¥¿¦¡¤¶²Ð±²°Ê¶b±±¨î¶µ¡C
±²°Ê¶b±±¨î¶µªºµøµ¡Ãþ§O¬O¡uSCROLLBAR¡v¡A¥Ñ¥~Æ[¨Ó¬Ý¡A±²°Ê¶b±±¨î¶µ¤À¦¨¤TºØ¡G¤ô¥¡B¹]Áè¤è¦V»P¤Ø¤o¤è¶ô¡C«Ø¥ß¤ô¥ªº±²°Ê¶b±±¨î¶µ¡A»Ý«ü©w SBS_HORZ ·®æ¡F«Ø¥ß¹]Á誺±²°Ê¶b±±¨î¶µ¡A»Ý«ü©w SBS_VERT ·®æ¡F«Ø¥ß¤Ø¤o¤è¶ô¡A»Ý«ü©w SBS_SIZEBOX ©Î SBS_SIZEGRIP ·®æ¡C¥k¹ÏÅã¥Ü«e¨âºØ±²°Ê¶b±±¨î¶µ¡A¥H¤Î¦U³¡¦WºÙ¡C«Ø¥ß±²°Ê¶b±±¨î¶µªº¤èªk¸ò¨ä¥L±±¨î¶µ¤@¼Ë¡A¦³¨âºØ¤èªk¡G①©I¥s CreateWindowEx¡B②¦b¹ï¸Ü²°±ªO©w¸q±²°Ê¶b±±¨î¶µ¡A¦A©I¥s DialogBoxParam¡C
①¡B©I¥s CreateWindowEx ®É¡Aµøµ¡Ãþ§O«ü©w¡u"SCROLLBAR",0¡v¦r¦ê¡A¨Ã¥B¨Ì¾Ún«Ø¥ß¤ô¥©Î¬O¹]Áè¤è¦Vªº±²°Ê¶b±±¨î¶µ¡A¨Ï¥Î SBS_HORZ ©Î SBS_VERT ·®æ¡A¥B¤£n§Ñ¤FÁÙn«ü©w¡uWS_CHILD or WS_VISIBLE¡v·®æ¤~¯à±N¦¹µøµ¡³]¬°¤lµøµ¡¨ÃÅã²{±±¨î¶µ¡C¨Ò¦p©³¤Uªº¨Ò¤l¬O«Ø¥ß¤ô¥¤è¦Vªº±²¶b±±¨î¶µ¡G
szSbClass DB "SCROLLBAR" ⁝ invoke CreateWindowEx,0,OFFSET szSbClass,0,WS_CHILD or WS_VISIBLE or SBS_HORZ,\ x,y,width,height,hwndParent,IDSB_HORZ,hInstance,0
②¡B¦b¹ï¸Ü²°±ªO©w¸q±²°Ê¶b±±¨î¶µ¡A¦A©I¥s DialogBoxParam¡CÁÙ¬O¥H¤ô¥±²°Ê¶b¬°¨Ò¡A¦b¹ï¸Ü²°±±¨î±ªO¤¤©w¸q¥i¥H¬O¤U±¨âªÌ¤¤ªº¤@ºØ¡G
SCROLLBAR IDSB_HORZ,x,y,aidth,heigth
©Î
CONTROL "",IDSB_HORZ,"SCROLLBAR",WS_CHILD|WS_VISIBLE|SBS_HORZN,x,y,width,heigth
µM«á©I¥s DialogBoxParam §Y¥i¡C
«Ø¥ß¦n±²°Ê¶b±±¨î¶µ¤§«á¡AÁÙ¥²¶·³]©w±²°Ê¤è¶ôªº¦ì¸m½d³ò¡C¤@¯ë¬O¦b³B²z WM_CREATE ©Î WM_INITDIALOG °T®§®É¡A©I¥s SetScrollRange¡A¥i°Ñ¾\²Ä¤E³¹¡C¦ý§Y¨Ï°µ¨ì³o¼Ëªº¦a¨B¡AÁÙµLªk¨Ï±²°Ê¶b±±¨î¶µ¥¿±`¹B§@¡A·í¨Ï¥ÎªÌ©ì¦²±²°Ê¤è¶ô©Î«ö¤U±²°Ê½bÀY¡A¦pªG¤£©I¥s SetScrollPos¡A±²°Ê¤è¶ô¤´·|¦^¨ìì³B¡C
±²°Ê¶b±±¨î¶µ¥i¥H¨Ï¥Îªº·®æ¦³¤U±¤QºØ¡G
±²°Ê¶b±±¨î¶µªº·®æ | ¼ÆÈ | »¡©ú |
SBS_HORZ | 0 | «Ø¥ß¤ô¥±²°Ê¶b±±¨î¶µ¡C¦pªG¤£¨ã SBS_BOTTOMALIGN¡B¤]¤£¨ã SBS_TOPALIGN ·®æ¡A«h±²°Ê¶b±±¨î¶µªº°ª«×¡B¼e«×©M¦ì¸m¥Ñ CreateWindowEx ©Î¹ï¸Ü²°±ªOªº x¡By¡Bwidth¡Bheight ¨M©w¡C |
SBS_VERT | 1 | «Ø¥ß¹]Áè±²°Ê¶b±±¨î¶µ¡C¦pªG¤£¨ã SBS_RIGHTALIGN¡B¤]¤£¨ã SBS_LEFTALIGN ·®æ¡A«h±²°Ê¶b±±¨î¶µªº°ª«×¡B¼e«×©M¦ì¸m¥Ñ CreateWindowEx ©Î¹ï¸Ü²°±ªOªº x¡By¡Bwidth¡Bheight ¨M©w¡C |
SBS_TOPALIGN | 2 | ±²°Ê¶b±±¨î¶µªº°ª«×¬°¨t²Î¹w³]ªº°ª«×¡A¥B¤W½t»P CreateWindowEx ©Î¹ï¸Ü²°±ªO¤¤¡Ax¡By¡Bwidth¡Bheight ©Ò©w¸qªº¯x§Î¤W½t¹ï»ô¡C¦¹·®æ¥²¶·»P SBS_HORZ ·f°t¨Ï¥Î¡C |
SBS_LEFTALIGN | 2 | ±²°Ê¶b±±¨î¶µªº¼e«×¬°¨t²Î¹w³]ªº¼e«×¡A¥B¥ª½t»P CreateWindowEx ©Î¹ï¸Ü²°±ªO¤¤¡Ax¡By¡Bwidth¡Bheight ©Ò©w¸qªº¯x§Î¥ª½t¹ï»ô¡C¦¹·®æ¥²¶·»P SBS_VERT ·f°t¨Ï¥Î¡C |
SBS_SIZEBOXTOPLEFTALIGN | 2 | ¨Ï¨ã¦³ SBS_SIZEBOXBOTTOMRIGHTALIGN ©Î SBS_SIZEBOXTOPLEFTALIGN ·®æªº±²°Ê¶b±±¨î¶µ¤º¡A¨ä¤Ø¤o¤è¶ô¦b±²°Ê¶b±±¨î¶µªº¥ª¤W¨¤¡C |
SBS_BOTTOMALIGN | 4 | ±²°Ê¶b±±¨î¶µªº°ª«×¬°¨t²Î¹w³]ªº°ª«×¡A¥B¤U½t»P CreateWindowEx ©Î¹ï¸Ü²°±ªO¤¤¡Ax¡By¡Bwidth¡Bheight ©Ò©w¸qªº¯x§Î¤U½t¹ï»ô¡C¦¹·®æ¥²¶·»P SBS_HORZ ·f°t¨Ï¥Î¡C |
SBS_RIGHTALIGN | 4 | ±²°Ê¶b±±¨î¶µªº¼e«×¬°¨t²Î¹w³]ªº¼e«×¡A¥B¥k½t»P CreateWindowEx ©Î¹ï¸Ü²°±ªO¤¤¡Ax¡By¡Bwidth¡Bheight ©Ò©w¸qªº¯x§Î¥k½t¹ï»ô¡C¦¹·®æ¥²¶·»P SBS_VERT ·f°t¨Ï¥Î¡C |
SBS_SIZEBOXBOTTOMRIGHTALIGN | 4 | ¨Ï¨ã¦³ SBS_SIZEBOXBOTTOMRIGHTALIGN ©Î SBS_SIZEBOXTOPLEFTALIGN ·®æªº±²°Ê¶b±±¨î¶µ¤º¡A¨ä¤Ø¤o¤è¶ô¦b±²°Ê¶b±±¨î¶µªº¥k¤U¨¤¡C |
SBS_SIZEBOX | 8 | ¦b CreateWindowEx ©Î¹ï¸Ü²°±ªO¤¤¡Ax¡By¡Bwidth¡Bheight ©Ò©w¸qªº¯x§Î¥k¤U¨¤¡A«Ø¥ß¥i½Õ¾ã¹ï¸Ü²°¤j¤pªº¤Ø¤o¤è¶ô¡C |
SBS_SIZEGRIP | 10H | ¦b CreateWindowEx ©Î¹ï¸Ü²°±ªO¤¤¡Ax¡By¡Bwidth¡Bheight ©Ò©w¸qªº¯x§Î¥k¤U¨¤¡A«Ø¥ß¥i½Õ¾ã±²°Ê¶b±±¨î¶µ¤j¤pªº¤Ø¤o¤è¶ô¡C |
¦pªG«Ø¥ß±²°Ê¶b±±¨î¶µ®É¡A«ü©w SBS_SIZEBOX ©ÎªÌ SBS_SIZEGRIP ·®æ¡A¨º»ò¥Í¦¨ªºµ²ªG¸ò·Q¹³¤¤ªº±²°Ê¶b±±¨î¶µ¤@ÂI¤]¤£¹³¡C¤U±¹ï¸Ü²°±ªO¥Í¦¨ªº±²°Ê¶b±±¨î¶µ³£¨S¦³±²°Ê½bÀY¡B±²°Êy¹D¡B±²°Ê¤è¶ôµ¥³¡¤À¡A¥u¦³¦b CreateWindowEx ©Î¹ï¸Ü²°±ªO¤¤¡Ax¡By¡Bwidth¡Bheight ©Ò©w¸qªº¯x§Î¥k¤U¨¤¦³¤@ºÙ¬°¤Ø¤o¤è¶ôªº³¡¤À¡A¦p¥k¹Ï¡C·í¨Ï¥ÎªÌ§â·Æ¹«´å¼Ð²¾¤J±²°Ê¶b±±¨î¶µ½d³ò¤º«ö¦í¤£©ñ¡AµM«á²¾°Ê·Æ¹«®É¡ASBS_SIZEBOX ·®æ·|§ïÅܹï¸Ü²°¤Ø¤o¡ASBS_SIZEGRIP ·|§ïÅܱ±¨î¶µ¤Ø¤o¡C
TSTSB DIALOGEX 200,100,110,112 FONT 10,"MS Shell Dlg" CAPTION "±²°Ê¶b±±¨î¶µªº·®æ" { LTEXT "SBS_SIZEBOX",1, 4, 5,60,8 CONTROL "",IDSB_RED, "SCROLLBAR",SBS_SIZEBOX|WS_BORDER, 4,15,100,30 LTEXT "SBS_SIZEGRIP",2, 4,51,60,8 CONTROL "",IDSB_GRN, "SCROLLBAR",SBS_SIZEGRIP|WS_BORDER,4,61,100,30 DEFPUSHBUTTON "Â÷¶}",IDB_EXIT, 60,95, 46,14 }
¹Ï¤¤¹ï¹ï¸Ü²°I´º¸g¹L¬V¦â¦¨¸û²`ªºÃC¦â¡A¦P®É¨ã¦³ WS_BORDER ·®æ¡A³o¼Ë´N¯à°÷¬Ý¥X±²°Ê¶b±±¨î¶µªº½d³ò¡C¦pªG¨ã¦³ SBS_SIZEBOX ©ÎªÌ SBS_SIZEGRIP ·®æªº±²°Ê¶b±±¨î¶µ¡A¦P®É¤]¦³ SBS_SIZEBOXBOTTOMRIGHTALIGN ·®æ¡A¨º»ò¤Ø¤o¤è¶ô·|¦ì©ó¥k¤U¨¤¡A³o¬O¹w³]È¡F¦pªG«ü©w¤F SBS_SIZEBOXTOPLEFTALIGN¡A¨º»ò¤Ø¦T¤è¶ô·|¦b¥ª¤W¨¤¡C¦pªG¨ã¦³³o¨âÓ·®æ¤¤ªº¨ä¤¤¤@Ó¡A¨º»ò¥u¦³¨Ï¥ÎªÌ§â·Æ¹«´å¼Ð²¾¦Ü¤Ø¤o¤è¶ô¤W¡A¤~¯à§ïÅܱ±¨î¶µ©Î¹ï¸Ü²°ªº¤j¤p¡C
À³¥Îµ{¦¡©I¥s SendMessage¡A¥i¥H±N¥H¤Uªº±²°Ê¶b±±¨î¶µ°T®§µo°eµ¹±²°Ê¶b±±¨î¶µ¡A¨Ï¨ä°µ¥X¬ÛÃö¦^À³¡G
±`¼Æ | »¡©ú |
ESB_DISABLE_BOTH | ¸T¥Î¨âÓ±²°Ê½bÀY |
ESB_DISABLE_DOWN | ¸T¥Î¦V¤U±²°Ê½bÀY |
ESB_DISABLE_LTUP | ¸T¥Î¦V¥ª©Î¦V¤W±²°Ê½bÀY |
ESB_DISABLE_LEFT | ¸T¥Î¦V¥ª±²°Ê½bÀY |
ESB_DISABLE_RTDN | ¸T¥Î¦V¥k©Î¦V¤U±²°Ê½bÀY |
ESB_DISABLE_UP | ¸T¥Î¦V¤W±²°Ê½bÀY |
ESB_ENABLE_BOTH | ±Ò¥Î¨âÓ±²°Ê½bÀY |
CCHILDREN_SCROLLBAR EQU 5 SCROLLBARINFO STRUCT cbSize DWORD ? rcScrollBar RECT <> dxyLineButton DWORD ? xyThumbTop DWORD ? xyThumbBottom DWORD ? reserved DWORD ? rgstate DWORD CCHILDREN_SCROLLBAR+1 dup (?) SCROLLBARINFO ENDS
¤W±¤EºØ°T®§¤¤ªº¤»ºØ¡GSBM_GETPOS¡BSBM_GETRANGE¡BSBM_GETSCROLLINFO¡BSBM_SETPOS¡BSBM_SETRANGE¡BSBM_SETSCROLLINFO ¥Î©ó¨t²Î¤º³¡¡AÀ³¥Îµ{¦¡¤£À³µo°e³o¨Ç°T®§µ¹±²°Ê¶b±±¨î¶µ¡A¦Ó¬O©I¥s¬ÛÃö Win64 API¡C¨Ò¦pnÀò±o±²°Ê¤è¶ô¦ì¸mÀ³©I¥s GetScrollPos¡AÀò±o±²°Ê¤è¶ô¦ì¸m¤§½d³òÀ³©I¥s GetScrollRange¡AÀò±o±²°Ê¶b¸ê®ÆÀ³©I¥s GetScrollInfo¡A³]©w±²°Ê¶b¤è¶ô¦ì¸mÀ³©I¥s SetScrollPos¡AÀò±o±²°Ê¤è¶ô¦ì¸m¤§½d³òÀ³©I¥s SetScrollRange¡A³]©w±²°Ê¶b±±¨î¶µ¸ê®ÆÀ³©I¥s SetScrollInfo¡C³o¤»ºØ°T®§§¡¥H·tºñ¦âÅã¥Ü¡C
·í¨Ï¥ÎªÌ¾Þ§@±²°Ê¶b±±¨î¶µ¡A¨Ã¤£¬O¹³«ö¶s¡B½s¿è®Øµ¥±±¨î¶µµo¥X WM_COMMAND °T®§¡A³qª¾¤÷µøµ¡¨Ï¥ÎªÌ°µ¤Fþ¨Ç°Ê§@¡A¦Ó¬Oµo¥X WM_HSCROLL ©Î WM_VSCROLL °T®§¡A³qª¾¤÷µøµ¡¡CÅã¦Ó©ö¨£ªº¡A¤ô¥±²°Ê¶b±±¨î¶µµo¥X WM_HSCROLL °T®§¡A¹]Áè±²°Ê¶b±±¨î¶µµo¥X WM_VSCROLL °T®§¡C
³o¨â«h°T®§¤¤¡AwParam ªº§C¦r²Õ¬O³qª¾½X¡A½Ð°Ñ¾\²Ä¤E³¹ªº»¡©ú¡F°ª¦r²Õ¬° NULL¡A°£¤F³qª¾½X¬O SB_THUMBPOSITION ©Î SB_THUMBTRACK ®É¡A°ª¦r²Õ¬O¨Ï¥ÎªÌ©ì¦²±²°Ê¤è¶ô·í®Éªº¦ì¸m¡ClParam ¬O±²°Ê¶b±±¨î¶µ¥N½X¡C
¦b¤W¤@³¹¤¶²Ð¤F±j¨î¦^À³¹ï¸Ü²°¡]¤]ºÙ¬°¼Ò¦¡¹ï¸Ü²°¡^¡A¨ä¤¤ªº½d¨Ò¡AMODAL1.ASM¡A¥¦¥ý«Ø¥ß¤F¤@¯ëµøµ¡¡A«ö¤U¥[³tÁ䤧«á¤~¼u¥X±j¨î¦^À³¹ï¸Ü²°¡C¨Æ¹ê¤W¨Ã¤£»Ýn¦h¦¹¤@Á|¡A¥i¥Hª½±µ«Ø¥ß±j¨î¦^À³¹ï¸Ü²°§@¬°µ{¦¡ªº¥Dn¤¶±¡A³o¼Ëªºµ{¦¡«Ü²³æ¡A¤£»Ýnµù¥Uµøµ¡Ãþ§O¡B¤£»Ýn«Ø¥ß°T®§´`Àô¡A¬O³\¦hµ{¦¡³]p®v³ß·R±Ä¥Îªº¤è¦¡¡A¦¹¤D¡u¥H¹ï¸Ü²°¬°¥Dn¤¶±ªºÀ³¥Îµ{¦¡¡v¡C¥¦ªºì©lµ{¦¡¥i¥H¼g¦¨¤U±ªº¡u¼ÒªO¡v¡G
OPTION CASEMAP:NONE OPTION WIN64:7 INCLUDE WINDOWS.INC INCLUDELIB KERNEL32.LIB INCLUDELIB USER32.LIB ;******************************************************************************* .CONST szDlgName DB "DLGNAME",0 ⁝ ;******************************************************************************* .DATA hInst HANDLE ? ;¼Ò²Õ¥N½X ⁝ ;******************************************************************************* .CODE ;------------------------------------------------------------------------------- DlgProc PROC hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM .if uMsg==WM_INITDIALOG ⁝ .elseif uMsg==WM_COMMAND mov rax,r8 ;R8W¡×ÃѧO½X shr rax,10h ;AX¡×³qª¾½X ⁝ .elseif uMsg==WM_CLOSE exit: invoke EndDialog,hDlg,0 .else ;¨ä¥L¥¼³B²zªº°T®§ªð¦^ FALSE xor rax,rax ret .endif ;¤w³B²zªº°T®§¡Aªð¦^ TRUE mov rax,1 ret DlgProc ENDP ;------------------------------------------------------------------------------- main PROC invoke GetModuleHandle,0 mov hInst,rax invoke DialogBoxParam,hInst,OFFSET szDlgName,0,OFFSET DlgProc,0 invoke ExitProcess,0 main ENDP ;******************************************************************************* END main
¥¦ªº¸ê·½´yzÀÉ¥i¥H¼g¦¨©³¤Uªº¼Ë¤l¡G
#include "RESOURCE.H" ⁝ DLGNAME DIALOGEX x, y, width, height FONT 10,"MS Shell Dlg" CAPTION "SOME TEXT" BEGIN CONTROL "text", id, "class name", style, x, y, width, height ⁝ END
¥»³¹½d¨Ò©Ò»Ýªºì²z¡A´X¥G¤w¤¶²Ð§¹²¦¡A¶È³Ñ¤U·|¨Ï¥Îªº Win64 API¡C
SetDlgItemText API ¥Î©ó³]©w¹ï¸Ü²°¤º¬YÓ±±¨î¶µªº¼ÐÃD©Î¤å¦r¡A¨Ò¦pÀRºA±±¨î¶µ¡B«ö¶s¡B½s¿è®Ø¤W±ªº¤å¦r¡C¥¦ªºì«¬¬O¡G
invoke SetDlgItemText,\ hDlg,\ ; handle of dialog box nIDDlgItem,\ ; identifier of control lpString ; text to set
hDlg ¬O¹ï¸Ü²°¥N½X¡An³]©w¤å¦rªº±±¨î¶µ¥]§t¦b¸Ó¹ï¸Ü²°¤º¡FnIDDlgItem ¬On³]©w¤å¦rªº±±¨î¶µÃѧO½X¡FlpString ¬O¥H¹sµ²§Àªº¦r¦ê¦ì§}¡A±±¨î¶µ¤Wªº¤å¦r·|³]¬°¦¹¦r¦ê¡C¦pªG SetDlgItemText °õ¦æ¦¨¥\¦^¶ÇȬ°¤@¡F¦pªG¥¢±Ñ¦^¶ÇȬ°¹s¡C
SetDlgItemText ¥i¥H¦b¤£ª¾¹D±±¨î¶µ¥N½X©Î¬O¥i¥H¬Ý¦¨¬Oµøµ¡¥N½Xªº±¡§Î¤U¡A³]©w¨ä¤å¦r¡A¹ï©ó¹ï¸Ü²°¤ºªº±±¨î¶µ¦Ó¨¥«Ü¤è«K¡CÀ³¥Îµ{¦¡¤]¥i¥H¦bª¾¹D±±¨î¶µ¥N½Xªº±¡§Î¤U¡A©I¥s SetWindowText ³]©w±±¨î¶µ¥N½X¤Wªº¤å¦r¡C
SetBkColor ¥Î¨Ó³]©w¤å¦rªºI´ºÃC¦â¡C¨ä쫬¬°¡G
invoke SetBkColor,\ hdc,\ ; handle of device context crColor ; background color value
hdc ¬O¸Ë¸m¤º®e¥N½X¡AcrColor ¬O¤å¦rªºI´ºÃC¦â¡C¦³ÃöÃC¦âªº³]©w¤èªk¡A°Ñ¾\²Ä¤Q¤@³¹ªº»¡©ú¡C¦pªG SetBkColor °õ¦æ¦¨¥\¡A¦^¶ÇȬOì¥ýªºI´ºÃC¦â¡F¦pªG¥¢±Ñ¡A¦^¶ÇȬO CLR_INVALID¡C¡]CLR_INVALID¡×¡Ð1¡^
SetBkColor ·|¥Î crColor ¶ñº¡¤å¦r½u±ø¤§¶¡ªº¶¡»Ø¡A¦ý¤£·|¶ñº¡¤å¦r©Ò¦û¤è¶ô¤§¥~ªºªÅ¶¡¡A¨ºªÅ¶¡¬Oµe¨ê¶ñº¡ªº¡]¨£µy«áªº WM_CTLCOLORSTATIC °T®§¡^¡CSetBkColor ¤]·|³]©w TextOut ©M ExtTextOut ªºI´ºÃC¦â¡C¦pªGI´º¼Ò¦¡¬° TRANSPARENT¡A¨º»ò SetBkColor ´NµL§@¥Î¡C¦pªGI´º¼Ò¦¡¬O OPAQUE¡A¥BI´º¬°ÂI°}¹Ï¡A¨º»ò¤]·|¨Ï¥ÎI´º¦â¡C
·í¨t²Înø»sÀRºA±±¨î¶µ¤§«e¡A·|§â WM_CTLCOLORSTATIC °T®§µo°eµ¹¤÷µøµ¡ªºµøµ¡¨ç¦¡¡CÀ³¥Îµ{¦¡¥i¥H¦b³B²z¦¹°T®§®É¡A³]©wÀRºA±±¨î¶µªº¤å¦rÃC¦â¡B¤å¦rI´ºÃC¦â¥H¤ÎÀRºA±±¨î¶µªºI´ºµe¨ê¡C·í¨t²Îµo°e WM_CTLCOLORSTATIC °T®§®É¡AwParam ¬OÀRºA±±¨î¶µªº¸Ë¸m¤º®e¥N½X¡AlParam ¬OÀRºA±±¨î¶µ¥N½X¡Fªð¦^¦Ü¨t²Î®É¡A¦^¶ÇȬOµe¨ê¥N½X¡A¨t²Î·|¥Î³oµe¨ê¶îº¡ÀRºA±±¨î¶µªºI´º¡C
¥»³¹¤¶²Ð¤F±²°Ê¶b±±¨î¶µ¥H¤Î¥H¹ï¸Ü²°¬°¥Dn¤¶±ªºÀ³¥Îµ{¦¡¡A©Ò¥H±µ¤U¨Ó«K¥Î¥¦Ì¨Ó¹ê§@¤@ÓÀ³¥Îµ{¦¡¡AMODAL2¡A¥¦°õ¦æ®Éµe±¦p¥k¹Ï¡C
²³©Ò©Pª¾¡AWindows §@·~¨t²ÎªºÃC¦â¬O¥H¬õ¡Bºñ¡BÂŤT¦â²Õ¦¨¡A¨CºØÃC¦âªº½d³ò¬O 0¡ã255 ¤§¶¡¡C¦pªG¤T¦â§¡¬°¹s¡A¥Nªí¶Â¦â¡FY¤T¦â§¡¬° 255¡A¥Nªí¥Õ¦â¡CMODAL2 ¦³¤TÓ±²°Ê¶b±±¨î¶µ¡A¨ä±²°Ê¤è¶ô¦ì¸m¤]¦b 0¡ã255 ¤§¶¡¡A¤À§Oªí¥Ü³o¤T¦âªº±j«×¡C¨Ï¥ÎªÌ¥i¥H©ì¦²±²°Ê¶b¤è¶ô¡B©Î«ö±²°Ê½bÀY¡B©Î¬O«ö±²°Êy¹D§ïÅܱ²°Ê¶b¤è¶ô¦ì¸m¡C¦b§ïÅܱ²°Ê¤è¶ô¦ì¸m¥kÃ䪺ÀRºA±±¨î¶µ¡A·|Åã¥Ü·í«e±²°Ê¤è¶ô¦ì¸m¡A¦P®É¥ª¤U¨¤ªºÀRºA±±¨î¶µÃC¦â·|ÀH¤§§ïÅÜ¡C
©³¤U¬O MODAL2.ASM ªº¤º®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 125 126
127 128 129 130 131 132
133 134 135 136 137 138
139 |
;®i¥Ü¥H¹ï¸Ü²°¬°¥Dn¤¶±ªºÀ³¥Îµ{¦¡
;²ÕĶ»P³sµ²¡G
;rc modal2.rc
;uasm64 -win64 modal2.asm
;link modal2.obj modal2.res /largeaddressaware:no
OPTION CASEMAP:NONE
OPTION WIN64:7
IDSB_RED EQU 2001
IDSB_GREEN EQU 2002
IDSB_BLUE EQU 2003
IDS_COLOR EQU 2004
IDB_EXIT EQU 2005
IDS_RED EQU 2006
IDS_GREEN EQU 2007
IDS_BLUE EQU 2008
INCLUDE WINDOWS.INC
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
INCLUDELIB GDI32.LIB
;*******************************************************************************
.CONST
szDlgName BYTE "COLOR",0
szFmt DB "%d",0
;*******************************************************************************
.DATA
hInst HANDLE ? ;¼Ò²Õ¥N½X
hRedSb HANDLE ? ;¥Nªí¬õ¦â±j«×ªº±²°Ê¶b±±¨î¶µ
hGrnSb HANDLE ? ;¥Nªíºñ¦â±j«×ªº±²°Ê¶b±±¨î¶µ
hBluSb HANDLE ? ;¥NªíÂŦâ±j«×ªº±²°Ê¶b±±¨î¶µ
hColor HANDLE ? ;¥NªíÃC¦âªºÀRºA±±¨î¶µ
iPos DD 3 DUP (0) ;¤TÓ±²°Ê¶b±±¨î¶µ¦ì¸m
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
DlgProc PROC hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL buffer[20h]:BYTE,tmp:QWORD
.if uMsg==WM_INITDIALOG
;¨ú±o¤TÓ±²°Ê¶b±±¨î¶µªº¥N½X¡A¤À§O¦s©óhRedSb¡BhGrnSb¡BhBluSb¤º¡A
;¨Ã³]©w¦¹¤TÓ±²°Ê¶b±±¨î¶µªº½d³ò¦b0¡ã255¤§¶¡
invoke GetDlgItem,hDlg,IDSB_RED
mov hRedSb,rax
invoke SetScrollRange,rax,SB_CTL,0,255,1
invoke GetDlgItem,hDlg,IDSB_GREEN
mov hGrnSb,rax
invoke SetScrollRange,rax,SB_CTL,0,255,1
invoke GetDlgItem,hDlg,IDSB_BLUE
mov hBluSb,rax
invoke SetScrollRange,rax,SB_CTL,0,255,1
;¨ú±oIDS_COLORÀRºA±±¨î¶µ¥N½X¡A¨äÃC¦â·|ÀHµÛ±²°Ê¶b±±¨î¶µ¤Wªº¤è¶ô¦ì¸m¦ÓÅÜ
invoke GetDlgItem,hDlg,IDS_COLOR
mov hColor,rax
.elseif uMsg==WM_COMMAND
mov rax,r8 ;R8W¡×ÃѧO½X
shr rax,10h ;AX¡×³qª¾½X
.if ax==BN_CLICKED
.if r8w==IDB_EXIT ;Y¨Ï¥ÎªÌ«ö¤UÂ÷¶}«ö¶s´Nµ²§ôÀ³¥Îµ{¦¡
jmp exit
.endif
.endif
.elseif uMsg==WM_HSCROLL
;§PÂ_¨Ï¥ÎªÌ¾Þ§@þÓ±²°Ê¶b±±¨î¶µ
.if r9==hRedSb
xor rax,rax ;RAX¡×0¡Aªí¥Ü¨Ï¥ÎªÌ¾Þ§@¥Nªí¬õ¦âªº±²°Ê¶b±±¨î¶µ
.elseif r9==hGrnSb
mov rax,4 ;RAX¡×4¡Aªí¥Ü¨Ï¥ÎªÌ¾Þ§@¥Nªíºñ¦âªº±²°Ê¶b±±¨î¶µ
.else
mov rax,8 ;RAX¡×8¡Aªí¥Ü¨Ï¥ÎªÌ¾Þ§@¥NªíÂŦ⪺±²°Ê¶b±±¨î¶µ
.endif
mov tmp,rax
;¨Ì¾Ú¨Ï¥ÎªÌªº¾Þ§@¡A§ïÅܬ۹ïÀ³±²°Ê¶b¤W±²°Ê¤è¶ô¦ì¸m
.if r8w==SB_LINELEFT
dec iPos[rax]
.elseif r8w==SB_LINERIGHT
inc iPos[rax]
.elseif r8w==SB_PAGELEFT
sub iPos[rax],10h
.elseif r8w==SB_PAGERIGHT
add iPos[rax],10h
.elseif r8w==SB_THUMBTRACK
mov r10,wParam
shr r10,10h
mov iPos[rax],r10d
.endif
;Àˬd±²°Ê¤è¶ô¦ì¸m¬O§_¦b0¡ã255¤§¶¡¡AY¤£¦b³o½d³ò«h½Õ¾ã¬°0©Î255
cmp iPos[rax],0
jl negat
cmp iPos[rax],255
jbe ok
mov iPos[rax],255
jmp ok
negat: mov iPos[rax],0
;§â±²°Ê¤è¶ô¦ì¸m¡AÅã¥Ü©ó±²°Ê¶b±±¨î¶µ¥kÃ䪺ÀRºA±±¨î¶µ¤W
ok: invoke wsprintf,ADDR buffer,OFFSET szFmt,iPos[rax]
mov rdx,tmp
shr rdx,2
add rdx,IDS_RED ;RDX¡×¨Ï¥ÎªÌ¾Þ§@ªº±²°Ê¶b±±¨î¶µÃѧO½X
invoke SetDlgItemText,hDlg,edx,ADDR buffer
;³]©w·sªº±²°Ê¶b¤è¶ô¦ì¸m
mov rax,tmp
invoke SetScrollPos,lParam,SB_CTL,iPos[rax],1
;±j¢IDS_COLORÀRºA±±¨î¶µ«Ã¸
invoke InvalidateRect,hColor,0,1
.elseif uMsg==WM_CTLCOLORSTATIC
.if r9==hColor
mov ecx,iPos[8] ;ECX¡×ÂŦâ±j«×
mov r10d,iPos[4] ;R10D¡×ºñ¦â±j«×
shl ecx,10h
shl r10d,8h
add ecx,iPos ;ECX¡×³Ì«áÃC¦â
add ecx,r10d
invoke CreateSolidBrush,ecx
ret
.endif
.elseif uMsg==WM_CLOSE
exit: invoke EndDialog,hDlg,0
.else ;¨ä¥L¥¼³B²zªº°T®§ªð¦^ FALSE
mov rax,0
ret
.endif ;¤w³B²zªº°T®§¡Aªð¦^ TRUE
mov rax,1
ret
DlgProc ENDP
;-------------------------------------------------------------------------------
main PROC
invoke GetModuleHandle,0
mov hInst,rax
invoke DialogBoxParam,hInst,OFFSET szDlgName,0,OFFSET DlgProc,0
invoke ExitProcess,0
main ENDP
;*******************************************************************************
END main |
©³¤U¬O MODAL2.RC ªº¤º®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 |
#include "RESOURCE.H"
#define IDSB_RED 2001
#define IDSB_GREEN 2002
#define IDSB_BLUE 2003
#define IDS_COLOR 2004
#define IDB_EXIT 2005
#define IDS_RED 2006
#define IDS_GREEN 2007
#define IDS_BLUE 2008
COLOR DIALOGEX 200,100,150,108
FONT 10,"MS Shell Dlg"
CAPTION "¥úªº¤Tì¦â"
BEGIN
RTEXT "¬õ",1, 4, 5, 10,10
SCROLLBAR IDSB_RED, 16, 4,100,10,SBS_HORZ
LTEXT "0", IDS_RED, 118, 5, 16,10
RTEXT "ºñ",2, 4,25, 10,10
SCROLLBAR IDSB_GREEN, 16,24,100,10,SBS_HORZ
LTEXT "0", IDS_GREEN, 118,25, 16,10
RTEXT "ÂÅ",3, 4,45, 10,10
SCROLLBAR IDSB_BLUE, 16,44,100,10,SBS_HORZ
LTEXT "0", IDS_BLUE, 118,45, 16,10
CTEXT "", IDS_COLOR, 16,64, 30,30
DEFPUSHBUTTON "Â÷¶}",IDB_EXIT, 85,80, 46,14
END |
ª`·N¨ì¡AMODAL2.RC ¤¤²Ä 24 ¦æªºÀRºA±±¨î¶µ¨Ã¨S¦³¤å¦r¡A§Y¨Ï¤§«á¤@ª½¨ì MODAL2 µ²§ô¡A¤]³£¨S¦³¤å¦r¡C²z¥Ñ«Ü²³æ¡A³oÓÀRºA±±¨î¶È¶È¥Î¨Óªí²{ÃC¦â¡A©Ò¥H¤£»Ýn¤å¦r¡C¬Æ¦Ü¦pªG¦³¤å¦r¡AÁÙ·|«Ü³Â·Ð¡C
°²³]¦³¤F¤@Ó¤å¦r¡uX¡v¡A°õ¦æµ²ªG·|Åܦ¨¥k¹Ï¡C³o®ÉÔÁÙn¶O¤ß©I¥s SetBkColor¡AÅý¤å¦rI´º¦â»P±±¨î¶µªºI´º¦â¤@¼Ë¡F¤]n©I¥s SetTextColor §ïÅܤå¦rÃC¦â¡C³o¼Ë°Z¤£¼W¥[³Â·Ð¡H©Ò¥H°®¯ÜÅý³oÓÀRºA±±¨î¶µ¦Û©l¦Ü²×¨S¦³¤å¦r¡C
±²°Ê¶b±±¨î¶µ¶Ç»¼°T®§µ¹¤÷µøµ¡¡A¨Ã¤£¬OÂÇ¥Ñ WM_COMMAND °T®§¡C¹ï©ó¤ô¥±²°Ê¶b±±¨î¶µ¡A¬O¾aµÛ WM_HSCROLL °T®§¡F¹ï©ó¹]Áè±²°Ê¶b±±¨î¶µ¡A«h¬O¾a WM_VSCROLL °T®§¡CÂǵ۳o¨âºØ°T®§¡A±²°Ê¶b±±¨î¶µ¤~¯à°÷§i¶D¤÷µøµ¡¡A¨Ï¥ÎªÌ°µ¤Fþ¨Ç¾Þ§@¡A¤÷µøµ¡¦bµøµ¡¨ç¦¡¤¤¤~¯à°µ¥X¬Û¹ïªº¦^À³¡C
¦ý¬O MODAL2 ªº¹ï¸Ü²°¦³¤TÓ±²°Ê¶b±±¨î¶µ¡A¤À§O¹ïÀ³¬õ¦â¡Bºñ¦â¡BÂŦâ±j«×ªº±²°Ê¶b±±¨î¶µ¡A¥¦Ì³£·|µo¥X WM_HSCROLL °T®§¡A¨ºn«ç»ò¤À¿ë©O¡H¨ä¹ê¤£Ãø¡A¥Ñ lParam ¤ºªº±²°Ê¶b±±¨î¶µ¥N½X¡A´N¯àª¾¹D¨Ï¥ÎªÌ¥¿¦b¾Þ§@þÓ±²°Ê¶b±±¨î¶µ¡C³o¬q¹Lµ{¦b MODAL2.ASM ªº²Ä 65¡ã73 ¦æ¡A³Ì«áµ²ªG¬ö¿ý©ó RAX ¼È¦s¾¹¤º¡A¦A¦s¤J tmp °Ï°ìÅܼƤ¤¡Cµ{¦¡½X¦p¤U¡G
65 ;§PÂ_¨Ï¥ÎªÌ¾Þ§@þÓ±²°Ê¶b±±¨î¶µ 66 .if r9==hRedSb 67 xor rax,rax ;RAX¡×0¡Aªí¥Ü¨Ï¥ÎªÌ¾Þ§@¥Nªí¬õ¦âªº±²°Ê¶b±±¨î¶µ 68 .elseif r9==hGrnSb 69 mov rax,4 ;RAX¡×4¡Aªí¥Ü¨Ï¥ÎªÌ¾Þ§@¥Nªíºñ¦âªº±²°Ê¶b±±¨î¶µ 70 .else 71 mov rax,8 ;RAX¡×8¡Aªí¥Ü¨Ï¥ÎªÌ¾Þ§@¥NªíÂŦ⪺±²°Ê¶b±±¨î¶µ 72 .endif 73 mov tmp,rax
¥i¯à·|¦³¤HÃhºÃ¡Aè褣¬O»¡¥H lParam §@¬°§PÂ_þÓ±²°Ê¶b±±¨î¶µµo¥Xªº WM_HSCROLL °T®§¶Ü¡H«ç»ò¤W±ªºªºµ{¦¡¤ù¬q¥Î R9 ¼È¦s¾¹©O¡H³o¬O¦]¬°¦b MODAL2.ASM ²Ä¤C¦æ¦³¹D±Ôz¡uOPTION WIN64:n¡v¡A·í n ªº²Ä¹s¦ì¤¸¬°¤@®É¡A·|¦Û°Ê¦b°Æµ{¦¡¤@¶}©l¨Ï RCX¡BRDX¡BR8¡BR9 Åܬ°«e¥|ӰѼơA©Ò¥H R9 ´Nµ¥©ó lParam¡C·í¨Ï¥ÎªÌ¾Þ§@¤£¦Pªº±²°Ê¶b±±¨î¶µ®É¡AR9 ¬°±±¨î¶µ¥N½X¡A¨Ì¾Ú R9 ³]©w RAX¡A¦p¤U¡G
¬°¦ó RAX n³]¬°³o¤TºØ¼Æ¡A¤£¦æ³] 0¡B1¡B2 ©Î¨ä¥L¼Æ¶Ü¡H³o©M¬ö¿ý¤TÓ±²°Ê¶b±±¨î¶µ¤W±²°Ê¤è¶ôªº¦ì¸m¦³Ãö¡C¦b MODAL2.ASM ªº²Ä 33 ¦æ©w¸q¤F¥Ñ¤TÓÂù¦r²Õªøªº¤¸¯À©Ò²Õ¦¨ªº°}¦C¡AiPos¡C¥Ñ¨ä¦WºÙ¥i¥Hª¾¹D¡A³oÓ°}¦C¬O¬ö¿ý¤TÓ±²°Ê¶b±±¨î¶µ¤W±²°Ê¶bªº¦ì¸m¡A¦Ó¥B¨CÓ¤¸¯Àªø 4 Ӧ줸²Õ¡C¤]´N¬O»¡ iPos[0] ¥Nªí¬õ¦â±²°Ê¶b¤W±²°Ê¤è¶ôªº¦ì¸m¡AiPos[4] ¥Nªíºñ¦â±²°Ê¶b¤W±²°Ê¤è¶ôªº¦ì¸m¡K¡K¡C
±µ¤U¨Ó²Ä 74¡ã87 ¦æµ{¦¡¦p¤U¡C¥Ñ wParam §C¦r²Õ¤ºªº¸ê®Æ¥i¥Hª¾¹D¨Ï¥ÎªÌ¶i¦æ¤F¤°»ò¾Þ§@¡AwParam ¦b¶i¤Jµøµ¡¨ç¦¡®É´N¦]²Ä¤C¦æªº¡uOPTION WIN64:7¡v±Ôz¡A¦Ó¦s©ó R8 ¼È¦s¾¹¡A©Ò¥H¥u»Ý¥Ñ R8W ¨Ó§PÂ_§Y¥i¡C¨Ò¦p·í¨Ï¥ÎªÌ«ö¤U¬õ¦â±²°Ê¶b±±¨î¶µ¤Wªº¦V¥k±²°Êy¹D¡A¨º»ò R8W ¬° SB_PAGERIGHT¡A¦]¦¹n¨Ï iPos ªº²Ä 0 Ó¤¸¯À¥[¤W 10H¡A©Ò¥Hn°õ¦æªº«ü¥O¬O¡uadd iPos[rax],10h¡v¡C
74 ;¨Ì¾Ú¨Ï¥ÎªÌªº¾Þ§@¡A§ïÅܬ۹ïÀ³±²°Ê¶b¤W±²°Ê¤è¶ô¦ì¸m 75 .if r8w==SB_LINELEFT 76 dec iPos[rax] 77 .elseif r8w==SB_LINERIGHT 78 inc iPos[rax] 79 .elseif r8w==SB_PAGELEFT 80 sub iPos[rax],10h 81 .elseif r8w==SB_PAGERIGHT 82 add iPos[rax],10h 83 .elseif r8w==SB_THUMBTRACK 84 mov r10,wParam 85 shr r10,10h 86 mov iPos[rax],r10d 87 .endif
³Ñ¤UªºÀˬd iPos[rax] ªº½d³ò¬O§_¦b 0¡ã100 ¤§¶¡¡A§ïÅܱ²°Ê¶b±±¨î¶µ¥kÃ䪺ÀRºA±±¨î¶µ¤Wªº¤å¦r¡A³]©w±²°Ê¤è¶ôªº¦ì¸m³£«Ü²³æ¡A¤£¶·¸Ôz¡C
³Ì«áªºÃøÃD¬O¡A·í¨Ï¥ÎªÌ¤w¸g¾Þ§@¤F±²°Ê¶b±±¨î¶µ¤§«á¡An¦p¦óIJµo WM_CTLCOLORSTATIC °T®§¡A³o¼Ë¤~¯à§Y®É§ïÅÜ¥ª¤U¨¤ªºÀRºA±±¨î¶µ¡]±±¨î¶µ¥N½X¦s©ó hColor Åܼơ^I´ºÃC¦â¡H³o®É¥i¥H©I¥s InvalidateRect¡AÅý hColor ¨ã¦³µL®Ä°Ï°ì¡C¦b MODAL2.ASM ªº²Ä 106 ¦æ¡A´N¬O¨Ï±o hColor ªº¾ãÓ¤u§@°Ï³£ÅܱoµL®Ä¡A³o¼Ë´N¥²¶·«Ã¸ hColor¡A¦p¦¹´N¯àIJµo WM)CTLCOLORSTATIC °T®§¡C
º¥ý¦b MODAL2 ¹ï¸Ü²°ùئ³¤CÓÀRºA±±¨î¶µ¡A¦ý¥u¦³±±¨î¶µ¥N½X¬O hColor ªºÀRºA±±¨î¶µ¡]¤]´N¬O¹ï¸Ü²°¥ª¤U¨¤ªºÀRºA±±¨î¶µ¡^n§ïÅÜI´ºÃC¦â¡A¨ä¾l¤£¥²¡C¦]¦¹¥²¶·¥Î .if/.endif ¨Ó§PÂ_¦¹ WM_CTLCOLORSTATIC ¬O§_¬° hColor µo¥X¨Óªº¡Cµ{¦¡¦b²Ä 108¡ã118 ¦æ¡A¸`¿ý¦p¤U¡G
108 .elseif uMsg==WM_CTLCOLORSTATIC 109 .if r9==hColor 110 mov ecx,iPos[8] ;ECX¡×ÂŦâ±j«× 111 mov r10d,iPos[4] ;R10D¡×ºñ¦â±j«× 112 shl ecx,10h 113 shl r10d,8h 114 add ecx,iPos ;ECX¡×³Ì«áÃC¦â 115 add ecx,r10d 116 invoke CreateSolidBrush,ecx 117 ret 118 .endif
·í .if/endif ÀË´ú¨ì¹ï¸Ü²°¥ª¤U¨¤ªºÀRºA±±¨î¶µµo¥Xªº WM_CTLCOLORSTATIC °T®§®É¡A¤~§â¦^¶Çȳ]¬°¥Ñ¤TÓ±²°Ê¶b±±¨î¶µ¥Í¦¨ªºÃC¦â©Ò«Ø¥ßªºµe¨ê¡A³o¼Ë¨t²Î´N¯à¥H¦¹µe¨ê¶ñº¡ÀRºA±±¨î¶µªºI´ºÃC¦â¤F¡CÁöµM¡A¨ä¥LªºÀRºA±±¨î¶µ¤]·|µo¥X WM_CTLCOLORSTATIC¡A¦ý¨Ã¨S¦³³]¸m¾A·íªº¦^¶ÇÈ¡A©Ò¥H¦b¨t²Î¤º³¡³]¸mµe¨ê®É·|µo¥Í¿ù»~¡A¦ýÁÙ¬O¦³ì¨Óªºµe¨ê¥i¨Ñ¨t²Î¨Ï¥Î¡A©Ò¥H¨ä¥LÀRºA±±¨î¶µ¤´¯à¥¿±`µe¥XI´ºÃC¦â¡C
¤W±ªºµ{¦¡²Ä 110¡ã115 ¦æ¡A¬O®Ú¾Ú±²°Ê¤è¶ô¦ì¸m¡A¤]¥i¥H»¡¬O¤Tì¦âªº±j«×¡Apºâ¥XÃC¦â¡AµM«á¦s©ó ECX ¼È¦s¾¹¡C²Ä 116 ¦æ«h¬O®Ú¾Ú ECX ¤ºÀx¦sªºÃC¦â©I¥s CreateSolidBrush «Ø¥ßµe¨ê¡ACreateSolidBrush ªº¦^¶ÇÈ´N¬O·sµe¨ê¥N½X¡A¦s©ó RAX¡AµM«áª½±µªð¦^¹ï¸Ü²°ºÞ²z¾¹¡A¹ï¸Ü²°ºÞ²z¾¹·|¦Û°Ê¨Ï¥Î·sµe¨êø»sI´º¡C
¥»³¹¤¶²Ð¤F¨âÓ¥DÃD¡G¡u±²°Ê¶b±±¨î¶µ¡v©M¡u¥H¹ï¸Ü²°¬°¥Dn¤¶±ªºÀ³¥Îµ{¦¡¡v¡C¥H«áªº½d¨Òµ{¦¡¡A¤j³¡¤À³£·|¬O¡u¥H¹ï¸Ü²°¬°¥Dn¤¶±ªºÀ³¥Îµ{¦¡¡v¬°¥D¡A¦]¬°¥¦¤Ó¤è«K¤F¡C¦ý¬O²Ó¤ßªº§A¡A¥i¯à·|µo²{¡A³o´X³¹¬Æ¦Ü§ó¦¤§«e©Ò«Ø¥ßªºµøµ¡³£¬OÁàÁ઺¡A¦ü¥G¸ò¤@¯ë¥«°â³nÅ骺µøµ¡¤£¤Ó¤@¼Ë¡C³o¬O¦]¬°¤§«eªº½d¨Òµ{¦¡³£¨S¦³¨Ï¥Î¡uvisual styles¡v¡A¤U¤@³¹¤¶²Ð¥¦¡C