Уроки Iczelion'а



         

Урок 21. Пайп - часть 5


.data? hInstance HINSTANCE ? hwndEdit dd ?

.code start: invoke GetModuleHandle, NULL

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

WinMain proc hInst:DWORD,hprevInst:DWORD,CmdLine:DWORD,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,IDR_MAINMENU 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_OVERLAppEDWINDOW+WS_VISIBLE,CW_USEDEFAULT,\ CW_USEDEFAULT,400,200,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 LOCAL rect:RECT LOCAL hRead:DWORD LOCAL hWrite:DWORD

LOCAL startupinfo:STARTUpINFO LOCAL pinfo:pROCESS_INFORMATION LOCAL buffer[1024]:byte LOCAL bytesRead:DWORD

LOCAL hdc:DWORD LOCAL sat:SECURITY_ATTRIBUTES .if uMsg==WM_CREATE invoke CreateWindowEx,NULL,addr EditClass, NULL, WS_CHILD+

WS_VISIBLE+ ES_MULTILINE+ ES_AUTOHSCROLL+ ES_AUTOVSCROLL, 0, 0, 0, 0, hWnd, NULL, hInstance, NULL mov hwndEdit,eax .elseif uMsg==WM_CTLCOLOREDIT

invoke SetTextColor,wparam,Yellow invoke SetBkColor,wparam,Black invoke GetStockObject,BLACK_BRUSH ret

.elseif uMsg==WM_SIZE mov edx,lparam mov ecx,edx shr ecx,16

and edx,0ffffh invoke MoveWindow,hwndEdit,0,0,edx,ecx,TRUE .elseif uMsg==WM_COMMAND .if lparam==0

mov eax,wparam .if ax==IDM_ASSEMBLE mov sat.niLength,sizeof SECURITY_ATTRIBUTES mov sat.lpSecurityDescriptor,NULL

mov sat.bInheritHandle,TRUE invoke Createpipe,addr hRead,addr hWrite,addr sat,NULL .if eax==NULL




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