Steward
分享是一種喜悅、更是一種幸福
程式語言 - MASM32 - Painting - Draw Pie
參考資訊:
http://www.winprog.org/tutorial/
http://winapi.freetechsecrets.com/win32/
https://github.com/gammasoft71/Examples_Win32
使用方式:
main.asm
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 | .386 .model flat,stdcall option casemap:none include c:\masm32\include\msvcrt.inc include c:\masm32\include\windows.inc include c:\masm32\include\kernel32.inc include c:\masm32\include\gdi32.inc include c:\masm32\include\user32.inc includelib c:\masm32\lib\msvcrt.lib includelib c:\masm32\lib\gdi32.lib includelib c:\masm32\lib\user32.lib includelib c:\masm32\lib\kernel32.lib .data szCaption db " main ",0 hWin dd 0 hInstance dd 0 CommandLine dd 0 defWndProc dd 0 .code WndProc proc hWnd: HWND , uMsg: UINT , wParam: WPARAM , lParam: LPARAM local hdc: dword local pen: dword local brush: dword local ps: PAINTSTRUCT . if uMsg == WM_PAINT invoke BeginPaint , hWnd, addr ps mov hdc, eax invoke CreatePen , PS_SOLID , 3, 0ffh mov pen, eax invoke CreateSolidBrush , 0ff00h mov brush, eax invoke SelectObject , hdc, pen invoke SelectObject , hdc, brush invoke Pie , hdc, 10, 10, 200, 200, 0, 0, 200, 100 invoke EndPaint , hWnd, addr ps invoke DeleteObject , pen invoke DeleteObject , brush xor eax , eax ret . elseif uMsg == WM_CLOSE invoke DestroyWindow , hWnd xor eax , eax ret . elseif uMsg == WM_DESTROY invoke PostQuitMessage , 0 xor eax , eax ret . endif invoke CallWindowProc , defWndProc, hWnd, uMsg, wParam, lParam ret WndProc endp WinMain proc hInst: DWORD , hPrevInst: DWORD , CmdLine: DWORD , CmdShow: DWORD local msg: MSG invoke CreateWindowEx , WS_EX_LEFT , WC_DIALOG , offset szCaption, WS_OVERLAPPEDWINDOW or WS_VISIBLE , 0, 0, 300, 300, NULL , NULL , NULL , NULL mov hWin, eax invoke SetWindowLong , hWin, GWL_WNDPROC , WndProc mov defWndProc, eax @@: invoke GetMessage , addr msg, NULL , 0, 0 cmp eax , 0 je @ f invoke DispatchMessage , addr msg jmp @ b @@: mov eax , msg.wParam ret WinMain endp start : invoke GetModuleHandle , NULL mov hInstance, eax invoke GetCommandLine mov CommandLine, eax invoke WinMain , hInstance, NULL , CommandLine, SW_SHOWDEFAULT invoke ExitProcess , eax end start |
Line 41:畫出一個Pie圖形
完成