Уроки Iczelion'а



         

Урок 18. Common Control'ы - часть 3


include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc include \masm32\include\comctl32.inc

includelib \masm32\lib\comctl32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib

WinMain pROTO :DWORD,:DWORD,:DWORD,:DWORD

.const IDC_pROGRESS equ 1 ; control IDs IDC_STATUS equ 2 IDC_TIMER equ 3

.data ClassName db "CommonControlWinClass",0

AppName db "Common Control Demo",0 progressClass db "msctls_progress32",0 ; the class name of the progress bar Message db "Finished!",0

TimerID dd 0

.data?

hInstance HINSTANCE ? hwndprogress dd ? hwndStatus dd ? CurrentStep dd ?

.code start: invoke GetModuleHandle, NULL mov hInstance,eax

invoke WinMain, hInstance,NULL,NULL, SW_SHOWDEFAULT invoke Exitprocess,eax invoke InitCommonControls

WinMain proc hInst:HINSTANCE,hprevInst:HINSTANCE,CmdLine:LpSTR,CmdShow:DWORD LOCAL wc:WNDCLASSEX

LOCAL msg:MSG LOCAL hwnd:HWND

mov wc.cbSize,SIZEOF WNDCLASSEX mov wc.style, CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndproc, OFFSET Wndproc mov wc.cbClsExtra,NULL

mov wc.cbWndExtra,NULL push hInst pop wc.hInstance mov wc.hbrBackground,COLOR_AppWORKSpACE

mov wc.lpszMenuName,NULL mov wc.lpszClassName,OFFSET ClassName invoke LoadIcon,NULL,IDI_AppLICATION mov wc.hIcon,eax

mov wc.hIconSm,eax invoke LoadCursor,NULL,IDC_ARROW mov wc.hCursor,eax invoke RegisterClassEx, addr wc

invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,ADDR AppName,\ WS_OVERLAppED+WS_CApTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_VISIBLE, \ CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,\ hInst,NULL

mov hwnd,eax .while TRUE invoke GetMessage, ADDR msg,NULL,0,0 .BREAK .IF (!eax)

invoke TranslateMessage, ADDR msg invoke DispatchMessage, ADDR msg .endw mov eax,msg.wparam

ret WinMain endp

Wndproc proc hWnd:HWND, uMsg:UINT, wparam:WpARAM, lparam:LpARAM .if uMsg==WM_CREATE invoke CreateWindowEx,NULL,ADDR progressClass,NULL,\ WS_CHILD+WS_VISIBLE,100,\ 200,300,20,hWnd,IDC_pROGRESS,\ hInstance,NULL mov hwndprogress,eax mov eax,1000 ; the lparam of pBM_SETRANGE message




Содержание  Назад  Вперед