¥»³¹±N¤¶²Ð¦p¦ó³B²z·Æ¹«ªº¿é¤J°T®§¡C
¤@¯ë·Æ¹«¤W¦³¨âÓ«öÁä¡A¤À§OºÙ¬°·Æ¹«¥ªÁä¥H¤Î·Æ¹«¥kÁä¡A¤]¦³¤TÁ䪺·Æ¹«¡A¤¤¶¡ªººÙ¬°·Æ¹«¤¤Áä¡C·í·Æ¹«´å¼Ð¦b¬YÓµøµ¡ªº¤u§@°Ï ( client area ) ®É¡A³o¨Ç«öÁä«ö¤U·|¤À§O²£¥Í WM_LBUTTONDOWN¡BWM_RBUTTONDOWN ¥H¤Î WM_MBUTTONDOWN °T®§¡F¤Ï¤§©ñ¶}®É¡A«h¤À§O²£¥Í WM_LBUTTONUP¡BWM_RBUTTONUP ¥H¤Î WM_MBUTTONUP °T®§¡C
³o¨Ç°T®§¤¤ªº lParam Äæ¦ìùس£¦s¦³³o¨Ç¨Æ¥óµo¥Í®Éªº·Æ¹«¦ì¸m¡A¨ä¤¤¸û§Cªº 16 ¦ì¤¸¬°·í®Éªº X ®y¼Ð¡A¸û°ªªº 16 ¦ì¤¸¬°·í®Éªº Y ®y¼Ð¡A¸Ó®y¼Ð¬O§âµøµ¡¤u§@°Ï¥ª¤W¨¤ªº®y¼Ð©w¬° (0,0)¡A¦Ó X ®y¼Ð¦V¥k¼W¥[¡AY ®y¼Ð¦V¤U¼W¥[ªº¤è¦¡ªí¥Ü¡C
¦Ó wParam Äæ¦ìùØ«h¦s¦³·í®ÉÁä½Lªºª¬ºA¡C°²¦p¦b«ö¤U·Æ¹«¤Wªº«öÁä®É¡A¤]¦P®É«ö¤UÁä½L¤WªºÁä¡A¨º»ò wParam ·|¦s¦³¸Ó«öÁ䪺µêÀÀÁä½X¡C°²¦p«ö¤U·Æ¹«¥ªÁä¦A«ö·Æ¹«¥kÁä¡A¨º»ò wParam ·|¦³¦s¦³ MK_RBUTTON¡C¸Ô²Óªº¼ÆȦp¤Uªí¡G
¼ÆÈ | »¡¡@©ú |
MK_CONTROL | Áä½L¤Wªº Ctrl Áä³Q«ö¤U |
MK_LBUTTON | ·Æ¹«¥ªÁä³Q«ö¤U |
MK_MBUTTON | ·Æ¹«¤¤Áä³Q«ö¤U |
MK_RBUTTON | ·Æ¹«¥kÁä³Q«ö¤U |
MK_SHIFT | Áä½L¤Wªº Shift Áä³Q«ö¤U |
MK_XBUTTON1 | ²Ä¤@ӷƹ«©µ¦ùªº«öÁä³Q«ö¤U |
MK_XBUTTON2 | ²Ä¤Gӷƹ«©µ¦ùªº«öÁä³Q«ö¤U |
¥t¥~ÁÙ¦³¤@Ó»P·Æ¹«¦³Ãöªº°T®§¡AWM_MOUSEMOVE¡CÅU¦W«ä¸q¡A³oÓ°T®§¬O¨t²Î³qª¾µ{¦¡¡A·Æ¹«´å¼Ð¦bµøµ¡®y¼ÐªºþÓ¦ì¸m¤W¡A¦¹®y¼Ð¬O¥Hµøµ¡¤u§@°Ï ( client area ) ªº¥ª¤W¨¤¬° ( 0,0 )¡C¨t²Î·|§â·Æ¹«´å¼Ðªº¬Û¹ï©ó¤u§@°Ï¥ª¤W¨¤ªº®y¼Ð©ñ¦b WM_MOUSEMOVE ªº lParam °Ñ¼Æùضǵ¹µøµ¡¡AlParam ªº¸û°ªªº 16 ¦ì¤¸¬O y ®y¼Ð¡A¸û§Cªº 16 ¦ì¤¸¬O x ®y¼Ð¡CwParam Äæ¦ì«h¦s¦³·í®Éªº«öÁ䱡§Î¡A©M WM_LBUTTONDOWN ¤@¼Ë¡C
WM_MOUSEMOVE ¦³¤@Ó¦a¤è»P¨ä¥L·Æ¹«°T®§¤£¦P¡A¨º´N¬O§Y¨Ïµøµ¡¤£¬O¥¿¦b§@¥Î¤¤¡A¨t²Î¤]·|µo¥X WM_MOUSEMOVE °T®§µ¹À³¥Îµ{¦¡¡C´«¥y¸Ü»¡¡A¦b Windows ¨t²Î®à±¤Wªºµøµ¡¡A¥un·Æ¹«´å¼Ð±qµøµ¡¤W·Æ¹L¡A¨t²Î´N·|µo¥X WM_MOUSEMOVE °T®§µ¹¸Óµøµ¡¡C
¦ý¬O¦pªG·Æ¹«´å¼Ð¦bµøµ¡¥~¡An¨ú±o·Æ¹«®y¼Ð¡A´NµLªk¥Ñ WM_MOUSEMOVE °T®§¨ú±o¤F¡A³o®É¥²¶·¥Î GetCursorPos API ¨Ó¨ú±o·Æ¹«¦ì¸m¡A¨ä쫬¬O
BOOL GetCursorPos( LPPOINT lpPoint // address of structure for cursor position );
³oÓ API ¶È¤@ӰѼơA¥¦«ü¦V¤@Ó POINT µ²ºcÅ骺¦ì§}¡A·í©I¥s GetCursorPos API ®É¡AGetCursorPos ·|§â·Æ¹«®y¼Ð¶ñ¤J¦¹µ²ºcÅé¡C¦¹µ²ºcÅ餺®e¦p¤U¡A
POINT STRUCT x DWORD ? y DWORD ? POINT ENDS
¬JµM¦³¤F GetCursorPos¡A§Y¨Ï·Æ¹«´å¼Ð¤£¦bµøµ¡¤º¡A¤]¥i¥H¨ú±o´å¼Ð¦ì¸m¡A¦ýn«ç¼ËIJµo³oÓ API ©O¡H¤@¯ëªº°µªk¬O§Q¥Î SetTimer ©w®É¹ïµøµ¡µo¥X WM_TIMER °T®§¡AµM«á³B²z¦¹°T®§®É©I¥s GetCursorPos ¥H¨ú±o·Æ¹«´å¼Ð¦ì¸m¡C
©³¤Uªº MOUSE4.ASM µ{¦¡·|¦bµøµ¡¥ªÃäÅã¥Ü¬õ¡BÂÅ¡Bºñ¤TÓÃäªø¬° 70 ÂIªº¥¿¤è§Î¡A¨ä§@¥Î¬Û·í©ó½Õ¦â½L¡A·í·Æ¹«´å¼Ð²¾¨ì³o¤TÓ¥¿¤è§Î¡A¦A³æÀ»·Æ¹«¥ªÁä¥i¥H¿ï¾Ü¬õ¡Bºñ¡BÂŤT¦â¤§¥ô¤@ºØÃC¦â¡C¦bµøµ¡¥kÃä¬O¤@¶ôªÅ¥Õªº°Ï°ì¡A¬Û·í©óµe¯È¡A·í·Æ¹«²¾¨ìµøµ¡¥kÃä¡A«ö¤U·Æ¹«¥ªÁä¥i¥HÅã¥Ü¥X·Æ¹«²¾°Êªºy¸ñ¡A¦A«ö¤@¤U¥ªÁä´N¤£Åã¥Üy¸ñ¡A¦n¹³¼ÒÀÀ¹]µ§¦V¤U¸IIJ¯È¥i¥Hµe¥X½u¨Ó¡A´£°_¹]µ§´NµLªkµe¥X½u¨Ó¤@¼Ë¡C¨äì©lµ{¦¡¦p¤U¡J
;¥ªÃ䦳½Õ¦â½L¡A¥i¥H¥H·Æ¹«¥ªÁä¿ï¾ÜÃC¦â¡Aµe¥Xy¸ñ .386 .model flat,stdcall option casemap:none include windows.inc include user32.inc include gdi32.inc include kernel32.inc includelib user32.lib includelib gdi32.lib includelib kernel32.lib red equ 0ffh green equ 0ff00h blue equ 0ff0000h WndProc proto :HWND,:UINT,:WPARAM,:LPARAM .DATA ClassName db 'SimpleWinClass',0 AppName db '·Æ¹«y¸ñ',0 AskExit db '¬O§_°h¥X¦¹µ{¦¡¡H',0 AskExitTitle db '¸ß°Ý',0 PenDown db FALSE ;23 TRUE¡J¤Uµ§¡AFALSE¡J´£µ§ DrawPaletteOK db FALSE ;24 ¬O§_¤wµe¥X¬õºñÂŤTÓ¥¿¤è§Î½Õ¦â½L color dd red ;25 µeµ§ÃC¦â color_id dd red,green,blue hInstance HINSTANCE ? hwnd HWND ? CommandLine LPSTR ? wc WNDCLASSEX <30h,?,?,0,0,?,?,?,?,0,offset ClassName,?> msg MSG <?> click_crd POINT <?> ;32 ³æÀ»·Æ¹«¥ªÁä®Éªº®y¼Ð¡A¤]¬O¤p¥¿¤è§Îªº¥ª¤W¨¤®y¼Ð lw_rt_x dd ? ;33 lw_rt_x »P lw_rt_y ¬O¤p¥¿¤è§Îªº¥k¤U¨¤®y¼Ð lw_rt_y dd ? .CODE start: invoke GetModuleHandle,NULL mov hInstance,eax invoke GetCommandLine mov wc.style,CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndProc,offset WndProc mov eax,hInstance mov wc.hInstance,eax mov wc.hbrBackground,COLOR_WINDOW+1 invoke LoadIcon,NULL,IDI_APPLICATION mov wc.hIcon,eax mov wc.hIconSm,eax invoke LoadCursor,NULL,IDC_ARROW mov wc.hCursor,eax invoke RegisterClassEx,offset wc invoke CreateWindowEx,NULL,offset ClassName,offset AppName,\ WS_OVERLAPPEDWINDOW,0,10,400,250,0,0,hInstance,NULL mov hwnd,eax invoke ShowWindow,hwnd,SW_SHOWDEFAULT invoke UpdateWindow,hwnd .while TRUE invoke GetMessage,offset msg,NULL,0,0 .break .if !eax invoke TranslateMessage,offset msg invoke DispatchMessage,offset msg .endw mov eax,msg.wParam invoke ExitProcess,eax ;--------------------------------------- ;µe¥X¦ì©óµøµ¡¥ªÃ䪺¬õ¡Bºñ¡BÂŤTÓÃäªø¬° 70 ªº¥¿¤è§Î½Õ¦â½L DrawPalette proc hWin:HWND ;67 DrawPalette °Æµ{¦¡¶}©l local PS:PAINTSTRUCT local hdc:HDC local newPen:DWORD local oldPen:DWORD local newBrush:HBRUSH local oldBrush:HBRUSH local counter:DWORD ;74 ¦]¬°nµe¤TÓ¥¿¤è§Î¡J0¡Ð¬õ¦â¡A1¡Ðºñ¦â¡K invoke BeginPaint,hWin,addr PS ;76 ¨ú±o DC ¥N½X mov hdc,eax ;77 ¦s¤J DC ¥N½X mov counter,0 ;78 ¥ýµe¥X¬õ¦â¥¿¤è§Î nxt: mov edx,counter shl edx,2 mov eax,color_id[edx] ;81 ¨ú±oÃC¦â invoke CreatePen,PS_SOLID,1,eax;82 «Ø¥ß·sªº¦âµ§ mov newPen,eax ;83 ¦s¤J·s¦âµ§¥N½X invoke SelectObject,hdc,eax ;84 ¿ï¾Ü·s¦âµ§ mov oldPen,eax ;85 «O¦s¦ⵧ¥N½X mov edx,counter shl edx,2 mov eax,color_id[edx] ;88 ¨ú±oÃC¦â invoke CreateSolidBrush,eax ;89 «Ø¥ß·sµ§¨ê mov newBrush,eax ;90 «O¦s·sµ§¨ê¥N½X invoke SelectObject,hdc,eax ;91 ¿ï¾Ü·sµ§¨ê mov oldBrush,eax ;92 «O¦sµ§¨ê¥N½X mov eax,counter ;93 pºâ¥¿¤è§Î°Ï°ì½d³ò¡A mov dl,70 ;94 ¸Ó¥¿¤è§Î¥ª¤W¨¤®y¼Ð¬° (0,70*counter) mul dl ;95 ¡A¥k¤U¨¤®y¼Ð¬O (69,70*counter+69) mov edx,eax add dx,69 invoke Rectangle,hdc,0,eax,69,edx ;98 µe¥X¥¿¤è§Î¨ÃµÛ¦â invoke SelectObject,hdc,oldPen ;99 «ì´_¦ⵧ invoke DeleteObject,newPen ;100 §R°£·s¦âµ§ invoke SelectObject,hdc,oldBrush ;101 «ì´_µ§¨ê invoke DeleteObject,newBrush ;102 §R°£·sµ§¨ê inc counter cmp counter,3 jne nxt invoke EndPaint,hWin,addr PS ret DrawPalette endp ;--------------------------------------- ;¥Ñ WM_LBUTTONDOWN¡BWM_MOUSEMOVE µ¥°T®§ªº lParam ºâ¥X x¡By ®y¼Ð¡A ;¨Ã¦s©ó click_crd µ²ºcÅé¤Î¨Ï click_crd ¤§ x¡By ®y¼Ð¦A¥[¤W 5 get_mouse proc crd:LPARAM mov eax,crd mov edx,5 and eax,0ffffh mov click_crd.x,eax add eax,edx mov lw_rt_x,eax mov eax,crd shr eax,10h mov click_crd.y,eax add eax,edx mov lw_rt_y,eax ret get_mouse endp ;--------------------------------------- ;·íµeµ§±µÄ²¯È®É¡A¨Ì©Ò«ü©wªºÃC¦â¤Î®y¼Ð¡Aµe¥XÃäªø 5 ÂIªº¥¿¤è§Î draw proc hWin:HWND local hDC:HDC local PS:PAINTSTRUCT local newPen:DWORD local oldPen:DWORD local newBrush:HBRUSH local oldBrush:HBRUSH invoke BeginPaint,hWin,addr PS mov hDC,eax invoke CreatePen,PS_SOLID,1,color mov newPen,eax invoke SelectObject,hDC,eax mov oldPen,eax invoke CreateSolidBrush,color mov newBrush,eax invoke SelectObject,hDC,eax mov oldBrush,eax invoke Rectangle,hDC,click_crd.x,click_crd.y,lw_rt_x,lw_rt_y invoke SelectObject,hDC,oldPen invoke DeleteObject,newPen invoke SelectObject,hDC,oldBrush invoke DeleteObject,newBrush invoke EndPaint,hWin,addr PS ret draw endp ;--------------------------------------- WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM .if uMsg==WM_LBUTTONDOWN ;156 ³æÀ»·Æ¹«¥ªÁä®É¡A invoke get_mouse,lParam ;157 ¥ýºâ¥X³æÀ»®É·Æ¹«´å¼Ð¦ì¸m .if click_crd.x>69 ;158 Y¸Ó®y¼Ð¤§ x ®y¼Ð¤j©ó 69 ®É xor PenDown,1 ;159 ¤Á´«¦âµ§¤U¸I¯È±©Î´£°_ .else ;160 §_«h .if click_crd.y<70 ;161 ·Æ¹«´å¼Ð¦b½Õ¦â½L°Ï¡A¥H y ®y¼Ð mov color,red ;162 ¬°¨Ì¾Ú¿ï¾ÜÃC¦â¡A¨Ã¦s©ó .elseif click_crd.y<140 ;163 color ÅܼÆùØ mov color,green .else mov color,blue .endif .endif .elseif uMsg==WM_MOUSEMOVE ;170 ²¾°Ê·Æ¹«®É .if PenDown ;171 Àˬdµeµ§¬O§_¦V¤U¸IIJ¯È¡A°²¦p¬Oªº¸Ü´N invoke get_mouse,lParam ;172 ¨ú±o²¾°Ê®É·Æ¹«ªº¦ì¸m .if click_crd.x<70 ;173 Àˬd·Æ¹«¦ì¸m¬O§_¦b½Õ¦â½L°Ï mov PenDown,FALSE ;174 ¬Oªº¸Ü¡A¨Ïµeµ§´£°_ .else ;175 §_ªº¸Ü¡A³]©wµL®Ä°Ï invoke InvalidateRect,hWnd,offset click_crd,TRUE .endif .endif .elseif uMsg==WM_PAINT ;180 «Ã¸®É .if DrawPaletteOK ;181 ¥ýÀˬd¬O§_¤w¸gµe¦n¬õºñÂŽզâ½L invoke draw,hWnd ;182 ¬Oªº¸Ü¡Aµe¥Xy¸ñ .else invoke DrawPalette,hWnd ;184 §_ªº¸Ü¡Aµe¥X½Õ¦â½L mov DrawPaletteOK,TRUE ;185 ³]©w¤w¸gµe¦n½Õ¦â½L¤F .endif .elseif uMsg==WM_CLOSE invoke MessageBox,hWnd,addr AskExit,\ addr AskExitTitle,MB_YESNO or MB_ICONQUESTION .if eax==IDYES invoke DestroyWindow,hWnd .endif .elseif uMsg==WM_DESTROY invoke PostQuitMessage,NULL .else invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .endif xor eax,eax ret WndProc endp end start
¦b°õ¦æ³oÓµ{¦¡®É¡A±zµe¥Xªºy¸ñ¥i¯à·|Â_Â_ÄòÄòªº¡A°£«D¬O±zºCºCªº²¾°Ê·Æ¹«¡A³o¨ÇÂI¤~·|¬O³sÄòªº¡A§ïµ½ªº¤èªk¥i¥H¥Îµe½u¥N´ÀµeÂI¡C¦Ü©óµe½u¥i¥Î MoveToEx API ¨Ó¹F¦¨¡C
¦³Ãö³oÓµ{¦¡ªºÅÞ¿è¡A¤p¤ì°¸¤w¼g¦bì©lµ{¦¡ªºµù¸Ñ¤¤¡A¬G¤£¦AÂرԡA©³¤U±N¤¶²Ð¦p¦ó§ïÅÜÃC¦â¤Îø¹ÏªºÆ[©À¡C
¨Æ¹ê¤W²Ä¤T³¹¤w¸gµy·L¤¶²Ð¹L¦p¦ó¦bµøµ¡¤WÅã¥Ü¸ê®Æ¡Jº¥ýn³]©wµL®Ä°Ï¥Hµo¥X WM_PAINT °T®§¡A·íµ{¦¡¦¬¨ì WM_PAINT¡A¥²¶·¥H BeginPaint ¤Î EndPaint ³o¨âÓ API ¬°°_©l¤Îµ²§ô¨Óªì©l¤Æ¸Ë¸m¤º¤å¤Îµ²§ô¸Ë¸m¤º®e ( device context )¡A¦Ó§ÚÌn¦p¦óø»s¹Ï§Îªºµ{¦¡½X«h§¨¦b³o¨âÓ API ¤§¶¡¡C©³¤U±N§ó¶i¤@¨B¤¶²Ð¦p¦ó§ïÅܳo¨Ç¹Ï§Î¤Î¤å¦rªºÃC¦â¡B¼Ë¦¡µ¥µ¥¡C
¦b¸Ë¸m¤º®eùØ¡A¦³Ãö¹Ï§Î©Î¤å¦rªº¼Ë¦¡¡A«Ü¹³¯u¹ê¥@¬Éªº¹êª«¡A¨Ò¦pnµe¤@Ó¬õ¦âªº¯x§Î¡A¨º»ò±z¥²¶·¥ý¦³¤@Ó¬õ¦âªºµeµ§¡AµM«á¦A¿ï¾Ü³oÓ¬õ¦âµ§¡A·íµe§¹«án§â¥¦©ñ¦^ì³B¡C©Ò¥H¡A§ÚÌ°õ¦æªº¤è¦¡¬O¥H CreatePen «Ø¥ßµeµ§¡A¥H SelectObject ¬°¸Ë¸m¤º®e¿ï¾Üµeµ§¡A¥H DeleteObject §R°£µeµ§¡A¦A¥Î SelectObject ÁÙìì¦âµ§¡C
쫬¬°¡J
HPEN CreatePen( int fnPenStyle, // pen style int nWidth, // pen width COLORREF crColor // pen color );
crColor ¬Oµeµ§ªºÃC¦â¡AnWidth ¬O«üµeµ§ªº¼e«×¡A°²¦p nWidth ¬° 0¡A¨º»ò CreatePen ·|µø¬°¤@¡A¦Ó©¿²¤¹sÈ¡AfnPenStyle ¬Oµeµ§ªº¼Ë¦¡¡A±`¥Îªº¼Ë¦¡¦p¤Uªí©Ò¥Ü¡J
¼ÆÈ | ¼Ë¦¡ | ¼ÆÈ | ¼Ë¦¡ |
PS_SOLID | ¹ê½u | PS_DASH | µê½u¡A¥Ñ³\¦hµu½u²Õ¦¨ |
PS_DOT | ÂI½u¡A¥Ñ³\¦hÂI²Õ¦¨ªº½u | PS_DASHDOT | µu½u¡BÂI¥æ¤¬²Õ¦¨ªº½u |
PS_DASHDOTDOT | ¥Ñµu½u¡B¨âÂI¥æ¤¬²Õ¦¨ªº½u | PS_NULL | ¬Ý¤£¨£ªº½u |
¤Wªíªº PS_ À³¸Ó¬O«ü pen style ªº·N«ä¡A°£¤F PS_SOLID¡BPS_NULL ¥~¡A¨ä¾lªº¼Ë¦¡³£¥u¦³¦b½u¼e¬°¤@®É¥i¥¿±`Åã¥Ü¥X½u¨Ó¡CCreatePen ©I¥s¦¨¥\·|¶Ç¦^¸Ó¦âµ§ªº¥N½X¡A³]pªÌ¥i¥H¥Î SelectObject §â¦¹¦âµ§¥N½X¿ï¤J¸Ë¸m¤º®eùØ¡A°²¦p©I¥s¥¢±Ñ·|¶Ç¦^ NULL¡C
³oÓ API ¬O§â·s«Ø¥ßªºª«¥ó¿ï¤J«ü©wªº¸Ë¸m¤º®eùØ¡A¨ú¥Nª«¥ó¡A¨ä쫬¬°¡J
HGDIOBJ SelectObject( HDC hdc, // handle of device context HGDIOBJ hgdiobj // handle of object );
hdc ¬O«ü©wªº¸Ë¸m¤º®e¡Ahgdiobj ¬On³Q¿ï¤J¸Ë¸m¤º®eªº¹Ï§Îª«¥ó¥N½X¡A¥i¥H¥Îªº¹Ï§Îª«¥ó¦³¦ì¤¸¹Ï ( Bitmap )¡Bµ§¨ê ( Brush )¡B¦r«¬ ( Font )¡Bµeµ§ ( Pen )¡B½d³ò ( Region ) µ¥¡A«Ø¥ß³o¨Ç¹Ï§Îª«¥óªº¸Ô²Ó¤èªk¡A½Ð¦Û¦æ°Ñ¦Ò Win32 Programmer's Reference¡C
¦pªG¿ï¾Üªºª«¥ó¤£¬O½d³òªº¸Ü¡A©I¥s SelectObject ¦¨¥\¡A¶Ç¦^Ȭ°Âªºª«¥ó¥N½X¡Aµ{¦¡¥i¥H«O¯dªº¹Ï§Îª«¥ó¥N½X¡A¥H«KÁÙì¡A¦pªG¥Î¤£¨ìªº¹Ï§Îª«¥ó¥N½X¤]¥i¥H§â¥¦§R°£¡FY©I¥s¥¢±Ñ¡A¶Ç¦^Ȭ° NULL¡C¦pªG¿ï¾Üªºª«¥ó¬O½d³òªº¸Ü¡A©I¥s¦¨¥\®É¡A¶Ç¦^Ȭ° SIMPLEREGION ( ¤@Ó¯x§Î½d³ò )¡BCOMPLEXREGION ( ¦hÓ¯x§Î½d³ò ) ©Î¬O NULLREGION ( ªÅ½d³ò )¡F¦pªG©I¥s¥¢±Ñ¡A«h¶Ç¦^ GDI_ERROR¡C
DeleteObject ¬O¥Î¨Ó§R°£µeµ§¡Bµ§¨ê¡B¦r«¬¡B¦ì¤¸¹Ï¡B½d³ò©Î©Î½Õ¦â½L ( Palette )¡A¥H¸`¬Ù¸ê·½¡C¨ä쫬¬°
BOOL DeleteObject( HGDIOBJ hObject // handle to graphic object );
hObject ¬On§R°£ªºª«¥ó¥N½X¡CDeleteObject ¦¨¥\§R°£ª«¥ó®É¡A·|¶Ç¦^«D¹sÈ¡A¥¢±Ñ®É¶Ç¦^ NULL¡C
CreateSoildBrush ·|«Ø¥ß¤@Ó·sªºµ§¨ê¡A쫬¬O¡J
HBRUSH CreateSolidBrush( COLORREF crColor // brush color value );
crColor ¬Oµ§¨êªºÃC¦â¡A°²¦p©I¥s¦¨¥\¡A·|¶Ç¦^µ§¨ê¥N½X¡A¥¢±Ñ«h¶Ç¦^ NULL¡Cµ§¨ê¬O¥Î¨Ó§â¤@¶ô½d³ò¶î¤W«ü©wªºÃC¦â¤Î¦UºØ¤£¦Pªº¼Ë¦¡¡ACreateSolidBrush ·|«Ø¥ß¤@ӶÃC¦âªºµ§¨ê¡A¨ä¥Lªº API ¤]¥i¥H«Ø¥ß¤£¦P¼Ë¦¡ªºµ§¨ê¡A¹³ CreatePatternBrush ·|«Ø¥ß¤@ӹϼ˪ºµ§¨ê¡A¸Ô²Ó±¡§Î½Ð¦Û¦æ°Ñ¦Ò Win32 Programmer's Reference¡C
Rectangle ·|¦b¤u§@°Ï¤Wµe¥X¤@Ó¯x§Î¡A¯x§ÎªºÃä½u¬O«ü©wªºµeµ§µe¥X¡A¯x§Î¤º³¡¬O¥H«ü©wªºµ§¨ê¶îº¡¡C¦pªG©I¥s¦¨¥\¡A¶Ç¦^«D¹sÈ¡A¥¢±Ñ¶Ç¦^ NULL¡CRectangle ªºì«¬¬O¡J
BOOL Rectangle( HDC hdc, // handle of device context int nLeftRect, // x-coord. of bounding rectangle's upper-left corner int nTopRect, // y-coord. of bounding rectangle's upper-left corner int nRightRect, // x-coord. of bounding rectangle's lower-right corner int nBottomRect // y-coord. of bounding rectangle's lower-right corner );
hdc ¬O¸Ë¸m¤º®e¡AnLeftRect¡BnTopRect¡BnRightRect¡BnBottomRect ¤À§O¬O¯x§Îªº¥ª¤W¨¤ X¡BY ®y¼Ð¡B¥k¤U¨¤ X¡BY ®y¼Ð¡C
³o¬q°Æµ{¦¡¬Oµe¥Xµøµ¡¥ªÃ䪺¤T¶ô¬õ¡Bºñ¡BÂÅ¥¿¤è§Î¡C·í·Æ¹«²¾¨ì¦¹³B¡A«ö¤U¥ªÁä¥i¥H¿ï¾Ü¦¹¤T¦âµe¥Xy¸ñ¡A¬G¤p¤ì°¸ºÙ¬°½Õ¦â½L¡A³o¸òø¹Ïª«¥óªº½Õ¦â½L¤£¦P¡C³oӰƵ{¦¡¥u»Ýn¦bµ{¦¡èÅã¥Üµøµ¡®É°õ¦æ¤@¦¸´N¥i¥H¤F¡A©Ò¥H¤p¤ì°¸¦bµ{¦¡²Ä 24 ¦æ³]©w¤@Ó DrawPaletteOK ÅܼƬ° FALSE¡A¥u¦³·í DrawPaletteOK ¬° FALSE ®É¤~°õ¦æ DrawPalette °Æµ{¦¡ ( ²Ä 181 ¦æ )¡Aµ¥ DrawPalette °Æµ{¦¡°õ¦æ§¹²¦¡A³]©w DrawPaletteOK ¬° TRUE ( ²Ä 185 ¦æ )¡A³o¼Ë DrawPalette °Æµ{¦¡´N¥u¦³¦bèÅã¥Üµøµ¡®É°õ¦æ¤@¦¸¡C
DrawPalette ªº¥Dn¥Øªº¬Oµe¥X¤TÓ¤£¦PÃC¦âªº¥¿¤è§Î¡A¤p¤ì°¸¦b¯ó½Z¯È¤W¥ýpºâ¥X³o¤TÓ¥¿¤è§ÎÃC¦â»P®y¼ÐÃö«Y¡A¦p¤Uªí¡J
ÃC¦â | ¥ª¤W¨¤®y¼Ð | ¥k¤U¨¤®y¼Ð |
¬õ | (0,0) | (69,69) |
ºñ | (0,70) | (69,139) |
ÂÅ | (0,140) | (69,209) |
¥J²ÓÆ[¹î³o¨Ç®y¼Ð«á¡A±zÀ³·í·|µo²{¨ä¥¿¤è§Îªº¥ª¤W¨¤ X ®y¼Ð§¡¬° 0¡A¥k¤U¨¤ X ®y¼Ð§¡¬° 69¡A¥ª¤W¨¤ªº Y ®y¼Ð§¡¬° 70 ªº¿¼Æ¡A¿²v¥Ñ¹s¶}©l¡A¦Ó¥k¤U¨¤ Y ®y¼Ð§¡¬°¥ª¤W¨¤ Y ®y¼Ð¥[ 69¡C¦³¤F³oÓÃö«Y¤§«á¡A¤p¤ì°¸³]¤@Ó°Ï°ìÅܼơAcounter¡A¨Óªí¥Ü²Ä´XÓ¥¿¤è§Î¡A¦Ó¨ä¥ª¤W¨¤®y¼Ð«Ü®e©ö´N¥i¥Î ( 0, 70*counter ) ªí¥Ü¡A¥k¤U¨¤®y¼Ð¥i¥Î ( 69, 70*counter+69 ) ªí¥Ü¡C
¦Ü©óÃC¦â¡A¤p¤ì°¸¬O§Q¥Îµ{¦¡ counter ¨Ó·í°µ«ü¼Ð¡A«ü¦Vµ{¦¡²Ä 26 ¦æªº color_id ©Ò¦C¥XªºÃC¦âÈ¡A¤£¹L³oÓ«ü¼Ð¤§È¤£¬O 0¡B1¡B2¡A¦Ó¬O 0¡B4¡B8¡A©Ò¥Hµ{¦¡²Ä 79 ¦æ¨ì²Ä 81 ¦æ§â counter ¼¥H 4 ¦A¦s¤J EDX¡C´«¥y¸Ü»¡ EDX ¤~¬O¯u¥¿«ü¼Ð¡A¦ý EDX ¬O®Ú¾Ú counter ¤§È¨Ópºâªº¡C
¦b±µ¤U¨Óªºµ{¦¡ùØ¡A´N¬O¥Î CreatePen «Ø¥ß·s¦âµ§¡A¥Î CreateSoildBrush «Ø¥ß·sµ§¨ê¡A¦A§â¥¦Ì¤À§O¿ï¶i¸Ë¸m¤º®e¡AµM«áµe¥X¥¿¤è§Î¡AµM«áÁÙì³o¨Çø¹Ïª«¥ó¡AµM«á¤S¶i¤J³B²z¤U¤@Ó¥¿¤è§Î´`Àô¡C
©³¤U³oÓµ{¦¡¡AMOUSE2.ASM¡A¯à§ì¨ú·Æ¹«´å¼Ð¦ì¸m¡A§Y¨Ï·Æ¹«¤£¦bµøµ¡¤º¡C¥t¥~¦]¬°³oÓµøµ¡nÅã¥Üªº¸ê°T«Ü¤Ö¡A¬G¤p¤ì°¸§â³oÓµøµ¡³]¬°«Ü¤p¡A¦Ó¥B¨î§ïÅܵøµ¡ªº¤j¤p¡A¦¹¥~¡A³oÓµ{¦¡ªº¼ÐÃDÁÙ·|ÀHµÛ·Æ¹«®y¼Ð¦ÓÅÜ¡Cì©lµ{¦¡¬°¡J
.386 .MODEL FLAT,STDCALL OPTION CASEMAP:NONE INCLUDE WINDOWS.INC INCLUDE USER32.INC INCLUDE GDI32.INC INCLUDE KERNEL32.INC INCLUDELIB USER32.LIB INCLUDELIB GDI32.LIB INCLUDELIB KERNEL32.LIB TimerID EQU 74 WndProc PROTO :HWND,:UINT,:WPARAM,:LPARAM crd_2_string PROTO :DWORD,:DWORD,:DWORD,:DWORD ;***************************************************************************************** .CONST ClassName DB 'SimpleWinClass',0 szTitleFmt DB '(%04d,%04d)',0 szMousePosiFmt DB '²{¦b·Æ¹«¦b¿Ã¹õ®y¼Ð¡J',0dh,0ah,'X=%04d¡AY=%04d',0 nMouseData EQU $-OFFSET szMousePosiFmt AskExit DB '¬O§_°h¥X¦¹µ{¦¡¡H',0 AskExitTitle DB '¸ß°Ý',0 ;***************************************************************************************** .DATA AppName DB 12 DUP (0) szString DB nMouseData DUP (0) hInstance HINSTANCE ? hwnd HWND ? CommandLine LPSTR ? wc WNDCLASSEX <30h,?,?,0,0,?,?,?,?,0,OFFSET ClassName,?> msg MSG > click_crd POINT > ;***************************************************************************************** .CODE start: INVOKE GetModuleHandle,NULL mov hInstance,eax INVOKE GetCommandLine mov wc.style,CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndProc,OFFSET WndProc mov eax,hInstance mov wc.hInstance,eax mov wc.hbrBackground,COLOR_WINDOW+1 INVOKE LoadIcon,NULL,IDI_APPLICATION mov wc.hIcon,eax mov wc.hIconSm,eax INVOKE LoadCursor,NULL,IDC_ARROW mov wc.hCursor,eax INVOKE RegisterClassEx,OFFSET wc INVOKE CreateWindowEx,0,OFFSET ClassName,OFFSET AppName,WS_SYSMENU or WS_MINIMIZEBOX\ ,0,10,210,70,0,0,hInstance,NULL ;051 «Ø¥ßµLÃä®Øªºµøµ¡ mov hwnd,eax INVOKE ShowWindow,hwnd,SW_SHOWDEFAULT INVOKE UpdateWindow,hwnd .WHILE TRUE INVOKE GetMessage,OFFSET msg,NULL,0,0 .BREAK .IF !eax INVOKE TranslateMessage,OFFSET msg INVOKE DispatchMessage,OFFSET msg .ENDW mov eax,msg.wParam INVOKE ExitProcess,eax ;----------------------------------------------------------------------------------------- WndProc PROC hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM LOCAL ps:PAINTSTRUCT LOCAL rcClient:RECT .IF uMsg==WM_CREATE INVOKE SetTimer,hWnd,TimerID,300,NULL .ELSEIF uMsg==WM_TIMER INVOKE GetCursorPos,OFFSET click_crd ;073 ¨ú±o·Æ¹«¦ì¸m INVOKE wsprintf,OFFSET AppName,OFFSET szTitleFmt,click_crd.x,click_crd.y INVOKE SetWindowText,hWnd,OFFSET AppName ;075 ³]©wµøµ¡¼ÐÃDÄæ INVOKE wsprintf,OFFSET szString,OFFSET szMousePosiFmt,click_crd.x,click_crd.y INVOKE InvalidateRect,hWnd,NULL,TRUE .ELSEIF uMsg==WM_PAINT INVOKE BeginPaint,hWnd,ADDR ps INVOKE GetClientRect,hWnd,ADDR rcClient INVOKE DrawText,ps.hdc,OFFSET szString,-1,ADDR rcClient,DT_LEFT;082 Åã¥Ü·Æ¹«¦ì¸m®y¼Ð INVOKE EndPaint,hWnd,ADDR ps .ELSEIF uMsg==WM_CLOSE INVOKE MessageBox,hWnd,ADDR AskExit,ADDR AskExitTitle,MB_YESNO or MB_ICONQUESTION .IF eax==IDYES INVOKE KillTimer,hWnd,TimerID INVOKE DestroyWindow,hWnd .ENDIF .ELSEIF uMsg==WM_DESTROY INVOKE PostQuitMessage,NULL .ELSE INVOKE DefWindowProc,hWnd,uMsg,wParam,lParam ret .ENDIF xor eax,eax ret WndProc ENDP ;***************************************************************************************** END start
è¤~´£¨ì¡A³oÓµ{¦¡·|¨î¨Ï¥ÎªÌ§ïÅܵøµ¡ªº¤j¤p¡A³o¬O¦]¬°¨ä¼ÐÃDÄ檺©ñ¨ì³Ì¤j³Q³]¬°µL®Ä¡A¦Ó¨S¦³³]©wµøµ¡Ãä®Ø¡A³o¬O©Mµ{¦¡²Ä 50 ¦æ CreateWindowEx API °Ñ¼Æªº dwStyle ¦³Ãö¡A±z¥i¥H°Ñ¦Ò Win32 Programmer's Reference ¤Î²Ä¤G³¹CreateWindowEx API¡A©³¤U¬Ý¬Ý´XºØ·®æ¡C
1. | °²¦p dwStyle °Ñ¼Æ¥Î WS_OVERLAPPED¡A¨º»òµøµ¡¨S¦³Ãä®Ø¡B¹Ï¥Ü¡B¨t²Î¿ï³æ¡BÁY¨ì³Ì¤p¡B©ñ¨ì³Ì¤j¡BÃö³¬µ¥¡A©Ò¥H¤£¶ÈµLªk§ïÅܵøµ¡¤j¤p¡A³sÃö³¬¦¹µ{¦¡³£±o«ö Ctrl¡ÐAlt¡ÐDel¡C¦p¥k¹Ï©Ò¥Ü¡C | ¡@ | |
2. | °²¦p dwStyle °Ñ¼Æ¥Î WS_SYSMENU¡A¨º»òÅã¥Üªºµøµ¡·|¦³¨t²Î¿ï³æ¤ÎÃö³¬«ö¶s¡A¦ýµLÃä®Ø¡A©Ò¥H¥i¥HÃö³¬¦ýµLªk§ïÅܵøµ¡¤j¤p¡C | ¡@ | |
3. | °²¦p dwStyle ¬O WS_SYSMENU or WS_MINIMIZEBOX¡A¨º»òµøµ¡·|¦³¨t²Î¿ï³æ¡BÃö³¬§á¡BÁY¨ì³Ì¤p«ö¶s¡A¦ýµLÃä®Ø¤Î³Ì¤j¤Æ«ö¶s¡C | ¡@ | |
4. | °²¦p dwStyle ¬O WS_SIZEBOX ªº¸Ü¡A¨º»òµøµ¡·|§Î¦¨¤@ÓÃä®Ø¡A¦ý¨S¦³¨t²Î¿ï³æ¡B³Ì¤j¤Æ¡B³Ì¤p¤Æ¡BÃö³¬«ö¶s¡A©Ò¥H¤]¥u¯à«ö Ctrl¡ÐAlt¡ÐDel µ²§ôµ{¦¡¡C¦¹¥~ WS_SIZEBOX ©M WS_THICKFRAME ªºµ²ªG¬O¤@¼Ëªº¡C | ¡@ | |
5. | °²¦p dwStyle ¬O WS_OVERLAPPEDWINDOW ªº¸Ü¡A¨º»òµøµ¡·|¦³Ãä®Ø¡B¨t²Î¿ï³æ¡B³Ì¤j¤Æ¡B³Ì¤p¤Æ¡BÃö³¬«ö¶s¡A¦p¥k¹Ï©Ò¥Ü¡CWS_OVERLAPPEDWINDOW ©M WS_TILEDWINDOW ®ÄªG¬O¤@¼Ëªº¡C | ¡@ |
SetWindowText ¥Î¨Ó§ïÅܵøµ¡ªº¼ÐÃDÄæ¡C¨ä쫬¦p¤U¡J
BOOL SetWindowText( HWND hWnd, // handle of window or control LPCTSTR lpString // address of string );
hWnd ¬On§ïÅܼÐÃDÄ檺µøµ¡¥N½X¡AlpString ¬O±N§ïÅܼÐÃDªº¦r¦ê¦ì§}¡A¦¹¦r¦ê¶·¥H 0 µ²§À¡C©I¥s¦¹ API «á·|¹ï§ïÅܪºµøµ¡µo¥X WM_SETTEXT °T®§¡C
wsprintf ¯à°÷§â¤@¨Ç¼ÆÈ¡B¦r¦ê¥H«ü©w®æ¦¡¶ñ¤J°O¾ÐÅé½w½Ä°ÏùØ¡A¥¦ªºì«¬¬O¡G
int wsprintf( LPTSTR lpOut, LPCTSTR lpFmt, ... );
lpOut ¬O«ü¦V½w½Ä°Ï¦ì§}¡Awsprintf ±N§â«ü©w®æ¦¡ªº¼ÆȩΦr¦ê¶ñ¤J¦¹½w½Ä°ÏùØ¡A³Ì¤j¥u¯à¦s¤J 1024 Ӧ줸²Õ¡ClpFmt ¬O«ü©w®æ¦¡¤Æ¦r¦êªº¦ì§}¡A¦¹¦r¦êªº¤º®eµy«á¦A´yz¡ClpFmt ¤§«áªº°Ñ¼Æ¬OnÅã¥ÜªºÅܼơA³o¨ÇÅܼƪºÓ¼Æ¨Ã¤£¤@©w¡A³o¤j·§¬O wsprintf ªº¯S¦â¡A¦b Win32 API ùØ¡A°£¤F wsprintf »P¨äÃþ¦üªº API ¤§¥~¡A¦ü¥G¨S¦³¨ä¥L API ¹³³o¼Ë°Ñ¼ÆӼƬO¤£©T©wªº¡A©ÎªÌ¤p¤ì°¸©t®¹è»D¥HP©ó¨S¨£¹L¡C¦pªG wsprintf °õ¦æ¦¨¥\¡A«h EAX ùئs©ñªº¬O¦³¦h¤Ö¦ì¤¸²Õ³Q¶ñ¤J½w½Ä°ÏùØ¡A¦ý¤£¥]§t³Ì«áªº NULL ¦r¤¸¡F¦pªG¥¢±Ñ¡AEAX ¤§È¤p©ó lpFmt ©Ò«ü¦r¦êªºªø«×¡C
lpFmt ¬O®æ¦¡¤Æ¦r¦ê¦ì§}¡A®æ¦¡¤Æ¦r¦ê¬O¥Î¨Ó«ü¥Ü¼Æ¦rªº®æ¦¡¡A¨Ò¦pÅã¥Ü¦h¤Ö¦ì¼Æ¡A©Î¬O¥H¤Q¶i¦ìÁÙ¬O¤Q¤»¶i¦ìªí¥Üµ¥µ¥¡A¦¹¥~®æ¦¡¤Æ¦r¦ê¤]¥i¥H¶ñ¤J¨ä¥L¤å¦r¡F¨CÓÅܼƪº®æ¦¡¬O¥H¡u%¡v¬°°_ÀYªº¡A¨ä»yªk¬O¡u%[-][#][0][width]type¡v¡Atype ¬O¸ê®Æ§ÎºA¡A»P¡u%¡v°t¦X«á¡A©Ò¥Nªí·N¸q¦p¤Uªí¡G
¸ê®Æ§ÎºA | ·N¡@¡@¸q |
%d | ¨Ï 32 ¦ì¤¸¼ÆÈ¿é¥X¦¨¤Q¶i¦ì¦³¸¹¾ã¼Æ |
%u | ¨Ï 32 ¦ì¤¸¼ÆÈ¿é¥X¦¨¤Q¶i¦ìµL¸¹¾ã¼Æ |
%s | ¿é¥X¦r¦ê |
%x | ¨Ï 32 ¦ì¤¸¼ÆÈ¿é¥X¦¨¤Q¤»¶i¦ìµL¸¹¼Æ¡A¥H 0¡ã9¡Ba¡ãf ªü©Ô§B¼Æ¦r¤Î^¤å¤p¼g¦r¥À¿é¥X |
%X | ¨Ï 32 ¦ì¤¸¼ÆÈ¿é¥X¦¨¤Q¤»¶i¦ìµL¸¹¼Æ¡A¥H 0¡ã9¡BA¡ãF ªü©Ô§B¼Æ¦r¤Î^¤å¤j¼g¦r¥À¿é¥X |
%i | »P¡u%d¡v¬Û¦P |
%I64d | ¨Ï 64 ¦ì¤¸¼ÆÈ¿é¥X¦¨¤Q¶i¦ì¦³¸¹¾ã¼Æ |
%I64x | ¨Ï 64 ¦ì¤¸¼ÆÈ¿é¥X¦¨¤Q¤»¶i¦ìµL¸¹¼Æ¡A¥H 0¡ã9¡Ba¡ãf ¿é¥X |
%I64X | ¨Ï 64 ¦ì¤¸¼ÆÈ¿é¥X¦¨¤Q¤»¶i¦ìµL¸¹¼Æ¡A¥H 0¡ã9¡BA¡ãF ¿é¥X |
¤Wªí¤¤ªº³Ì«á¤T¶µ¥u¯à¥Î¦b Windows XP ¥H«áªº¨t²Î¡Aµy«á¦A»¡©ú¡A¨ä¾lªº§¡¥i¥Î¦b Windows 9x/Me ©Î XP ¨t²Î¡C¦b¡u%¡v»P¡u¸ê®Æ§ÎºA¡v¤§¶¡ÁÙ¥i¥H´¡¤J¡uwidth¡vªí¥Ü¿é¥Xªº¼e«×¡A¡uwidth¡v¥u¯à¬O¤@Óªü©Ô§B¼Æ¦r¡A¦pªG¡uwidth¡v¬° 8¡Aªí¥Ü¿é¥X¤KÓ¦r¤¸ªº¼e«×¡A¤£¨¬ªº¤KÓ¦r¤¸ªº¥HªÅ¥Õªí¥Ü¡C¦ý¬O¦pªG¦b¡uwidth¡v¤§«e¥[¤W¡u0¡v¡A«h¿é¥Xµ²ªG¤£¨¬¼e«×ªº¥H¡u0¡v¸É¨¬¡A·íµM¡u0¡v¤]¥i¥H¤£¥[¡A¤£¥[ªº¸Ü´N¥HªÅ¥Õ¸É¨¬¡C¥[¤W¡u#¡v¡Aªí¥Ü¦b¤Q¤»¶i¦ì¼Æ¦r¥[¤W¦rº¡u0X¡v©Î¡u0x¡v¡A¤£¬O¤Q¤»¶i¦ìªº«h¤£¼vÅT¡C¥[¤W¡u-¡v¡Aªí¥Ü¿é¥X¬°¦V¥ª¹ï»ô¡A¤£¥[ªí¥Ü¦V¥k¹ï»ô¡A³oÓ¥u¼vÅT³]¦³¼e«×¥B¿é¥Xªº¼ÆȤp©ó¼e«×¡C©³¤U¬O¤@¨Ç¨Ò¤l¡G
.586 .MODEL FLAT,STDCALL OPTION CASEMAP:NONE INCLUDE WINDOWS.INC INCLUDE KERNEL32.INC INCLUDE USER32.INC INCLUDELIB KERNEL32.LIB INCLUDELIB USER32.LIB ;********************************************************************* .CONST kilo DWORD 1024 mega DWORD 1024*1024 giga DWORD 1024*1024*1024 szFmtK BYTE '1%c Bytes¡×%-#8X Bytes¡×%8d¦ì¤¸²Õ',0dh,0ah,0 szFmtM BYTE '1%c Bytes¡×%08Xh Bytes¡×%d¦ì¤¸²Õ',0dh,0ah,0 szFmtG BYTE '1%c Bytes¡×%8Xh Bytes¡×%d¦ì¤¸²Õ',0dh,0ah,0 szTitle BYTE '³æ¦ì',0 ;********************************************************************* .DATA pBuffer LPSTR ? szBuffer BYTE 1024 DUP (0) ;********************************************************************* .CODE ;--------------------------------------------------------------------- start: xor eax,eax mov al,'K' mov pBuffer,OFFSET szBuffer INVOKE wsprintf,pBuffer,OFFSET szFmtK,eax,kilo,kilo add pBuffer,eax xor ecx,ecx mov cl,'M' INVOKE wsprintf,pBuffer,OFFSET szFmtM,ecx,mega,mega sub edx,edx add pBuffer,eax mov dl,'G' INVOKE wsprintf,pBuffer,OFFSET szFmtG,edx,giga,giga INVOKE MessageBox,NULL,OFFSET szBuffer,OFFSET szTitle,\ MB_OK or MB_ICONINFORMATION INVOKE ExitProcess,NULL ;********************************************************************* END start |
¡@¦¹µ{¦¡°õ¦æ«áªºµe±¬O¡G |
%I64d¡B%I64x ©M %I64X ¬O¥Î¨Ó³B²z 64 ¦ì¤¸¼ÆÈ¿é¥X¨ì¬YÓ°O¾ÐÅ餤¡A¦]¬°¦b Win32 ¨t²Î¤¤¡A¨CӰѼƥu¯à¬O 32 ¦ì¤¸¡A¦]¦¹±o¤À¨â¦¸±À¤J°ïÅ|¡A¥ý±À¤J¸û°ªªº 32 ¦ì¤¸¡A«á±À¤J¸û§Cªº 32 ¦ì¤¸¡A¨Ò¦pn¿é¥X tera ( tera¡×1099511627776d¡×10000000000h )¡Aµ{¦¡¦p¤U¡G
szFmt DB '%I64d',0 buffer DB 1024 DUP (0) mov eax,0 mov edx,100h ;EDX:EAX¡×10000000000h INVOKE wsprintf,OFFSET buffer,OFFSET szFmt,eax,edx
¦b Win32 ¨t²ÎùØ¡A©I¥s¨ó©w¬O stdcall¡A¥ç§Y³Ì¥kÃ䪺°Ñ¼Æ³Ì¥ý³Q±À¤J°ïÅ|¡A³Ì¥ªÃ䪺°Ñ¼Æ³Ì«á³Q±À¤J°ïÅ|¡A©Ò¥H EDX ¤ñ EAX ¥ý±À¤J°ïÅ|¡C¦]¦¹¦bì©l½X¤¤¡A¦pªG©I¥s wsprintf¡A¿é¥X 64 ¦ì¤¸¼ÆÈ¡A¸û§Cªº 32 ¦ì¤¸À³¼g¦b¥ªÃä¡A¸û°ªªº 32 ¦ì¤¸¼g¦b¥kÃä¡C
¦¹³¹¡A¤p¤ì°¸»¡©ú¦p¦ó³B²z·Æ¹«°T®§¡A°²¦p±z±q¡y¦b Win32 Àô¹Ò¤U¼¶¼g²Õ¦X»y¨¥¡zªº²Ä¹s³¹¶}©l¤@ª½¯à°í«ù¨ì³o¤@³¹³£¯à¤U¤u¤Ò¬ã¨sªº¸Ü¡A§Ú·Q±z¥i¯à·|ı±o¡A¦b Win32 Àô¹Ò¼¶¼gµ{¦¡¤JªùªºªùÂe«Ü°ª¡A¦ý¬O°²¦p±z¯à´x´¤°T®§ÅX°Êªº¤j¤è¦V«á¡A¨ä¹ê¨Ã¤£·|¤ñ¦b DOS Àô¹Ò¤U§xÃø¡C¥H³o³¹ªº²Ä¤@Óµ{¦¡¡AMOUSE4.ASM¡A¨Ó»¡¡A±z°²¦p·Q¦b DOS Àô¹Ò¤U¼¶¼gÃþ¦üªºµ{¦¡¡A¤j·§¬O¤£®e©öªº¡A¦ý¬O¦b Win32 Àô¹Ò°õ¦æªº MOUSE4.ASM ¥u¥Î¤F¬ù¨â¦Ê¦æ´Nµ²§ô¤F¡C
·íµM¡AMOUSE4.ASM ùØ©Òµe¥X¨Óªºy¸ñ¬OÂ_Â_ÄòÄòªº¡A¨S¦³³s¦b¤@°_¤£¤Ó¦n¬Ý¡A±z¥i¥H¥Î MoveToEx ©M LineTo ³o¨âÓ API ¥[¥H§ï¶i¡A½Ð°Ñ¦Ò Win32 Programmer's Reference ¦Û¦æ§ï¨}¡C
¥t¥~¡A¹ï©óµøµ¡¤º¨Ï¥Î¤£¦Pªº¦r«¬®É¡A¨ä·Qªk¤]¹³§ïÅܵeµ§ªº¤è¦¡¬Û¦P¡A