汇编—#0窗口程序源码

来源:互联网 发布:sql server中通配符 编辑:程序博客网 时间:2024/05/21 18:32

编译器:MASMPlus

代码:

.386.model flat,stdcalloption casemap:noneincludewindows.incincludeuser32.incincludelibuser32.libincludekernel32.incincludelibkernel32.lib;所有API函数的返回值保存在eax.data?hInstanceDD?hWinMainDD?.data.constszClassNameDB'MyClass',0szCaptionMainDB'标题',0.code;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 响应用户操作;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_ProcWinMainprocuses ebx edi esi,hWnd,uMsg,wParam,lParammoveax,uMsg;*************************可修改**************************.ifeax ==WM_CLOSE              ;关闭按钮invokeDestroyWindow,hWinMaininvokePostQuitMessage,NULL;下面 .elseif eax ==  ******;          需要执行的代码;例如;     .elseif eax == WM_LBUTTONDOWN          ;鼠标左键被按下  ;        invoke MessageBox,0,NULL,NULL,MB_OK ;弹出信息框;*************************可修改**************************.elseinvokeDefWindowProc,hWnd,uMsg,wParam,lParamret.endifxoreax,eaxret_ProcWinMainendp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;                 _WinMain子过程——好戏开始                           ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_WinMainproclocal@stWndClass:WNDCLASSEX                                  ;定义stWndClass类结构为WNDCLASSEXlocal@stMsg:MSGinvokeGetModuleHandle,NULL                                    ;获取应用程序句柄movhInstance,eax                                           ;窗口句柄保存在hInstanceinvokeRtlZeroMemory,addr @stWndClass,sizeof @stWndClass       ;初始类内容为0;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 注册窗口类;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>invokeLoadCursor,0,IDC_ARROW                                  ;载入光标mov@stWndClass.hCursor,eax                                 ;载入光标pushhInstance                                               pop@stWndClass.hInstance                                   ;应用程序句柄mov@stWndClass.cbSize,sizeof WNDCLASSEX                    ;获取WNDCLASSEX结构大小,这段不用改mov@stWndClass.style,CS_HREDRAW or CS_VREDRAW              ;窗口风格mov@stWndClass.lpfnWndProc,offset _ProcWinMain             ;响应用户操作,这段不用改mov@stWndClass.hbrBackground,COLOR_WINDOW + 1              ;句柄画刷mov@stWndClass.lpszClassName,offset szClassName            ;这个类名字为szClassNameinvokeRegisterClassEx,addr @stWndClass                        ;注册这个窗口类;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 建立并显示窗口;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>invokeCreateWindowEx,NULL,\            ;扩展   offset szClassName,\                   ;@stWndClass类的名字   offset szCaptionMain,\                 ;标题WS_OVERLAPPEDWINDOW,\                  ;窗口类型100,100,\                              ;X,Y坐标600,400,\                              ;窗口宽度,窗口高度NULL,\                                 ;父窗口句柄NULL,\                                 ;菜单句柄hInstance,\                            ;应用程序的句柄NULLmovhWinMain,eax                        ;保存CreateWindowEx创建出来的句柄invokeShowWindow,hWinMain,SW_SHOWNORMAL;显示出来的样式invokeUpdateWindow,hWinMain            ;可加可不加;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 消息循环,不用修改;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.whileTRUEinvokeGetMessage,addr @stMsg,NULL,0,0.break.if eax== 0invokeTranslateMessage,addr @stMsginvokeDispatchMessage,addr @stMsg.endwret_WinMainendp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 程序入口;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>start:call    _WinMain           ;调用_WinMain子过程invokeExitProcess,NULLendstart