当前位置: 代码迷 >> 汇编语言 >> 学习win32汇编出现有关问题了,大婶们来帮帮小弟一下
  详细解决方案

学习win32汇编出现有关问题了,大婶们来帮帮小弟一下

热度:1032   发布时间:2016-05-02 05:07:09.0
学习win32汇编出现问题了,大婶们来帮帮小弟一下 啊
.386
.model flat,stdcall
option casemap:none

include      windows.inc
include      gdi32.inc
includelib   gdi32.lib
include      kernel32.inc
includelib   kernel32.lib
include      user32.inc
includelib   user32.lib

.data?
hWinMain     dd     ?

.const
szWinName    db     'First windows',0
szWinCaption db     'windows',0
szText       db     '欢迎来到win32汇编程序设计!',0

.code
_ProcWinMain  proc uses eax ebx esi edi,hWnd,uMsg,wParam,lParam
              local @wndcls:WNDCLASS
  local @ps:PAINTSTRUCT
  local @hdc
  
  mov eax,uMsg
  .if eax == WM_PAINT
      invoke BeginPaint,hWnd,addr @ps
                  mov @hdc,eax
  invoke TextOut,@hdc,0,25,addr szText,sizeof szText
  invoke EndPaint,@hdc,addr @ps
  .elseif eax == WM_CLOSE
      invoke DestroyWindow,hWinMain
  invoke PostQuitMessage,NULL
  .else
      invoke DefWindowProc,hWnd,uMsg,wParam,lParam
  ret
  .endif
  xor eax,eax
  ret
_ProcWinMain  endp


_WinMain proc uses eax ebx esi edi,hInstance,hPrevInstance,lpCmdLine,nCmdShow  
         local @wndcls:WNDCLASS
 local @msg:MSG
 
 mov @wndcls.style,CS_VREDRAW or CS_HREDRAW
 mov @wndcls.lpfnWndProc,offset _ProcWinMain
 mov @wndcls.cbClsExtra,0
 mov @wndcls.cbWndExtra,0
 push hInstance
 pop @wndcls.hInstance
 invoke LoadIcon,NULL,IDI_APPLICATION
 mov @wndcls.hIcon,eax
 invoke LoadCursor,NULL,IDC_ARROW
 mov @wndcls.hCursor,eax
 mov @wndcls.hbrBackground,COLOR_WINDOW
 mov @wndcls.lpszMenuName,NULL
 mov @wndcls.lpszClassName,offset szWinName
 
 invoke RegisterClass,addr @wndcls
 invoke CreateWindowEx,WS_EX_CLIENTEDGE,addr szWinName,addr szWinCaption,WS_OVERLAPPEDWINDOW,\
        100,100,300,340,NULL,NULL,hInstance,NULL
mov hWinMain,eax
invoke ShowWindow,hWinMain,SW_SHOWNORMAL
invoke UpdateWindow,hWinMain

.while TRUE
       invoke GetMessage,addr @msg,NULL,0,0
   .break .if eax == 0
   invoke TranslateMessage,addr @msg
   invoke DispatchMessage,addr @msg
.endw
ret
_WinMain endp

start:
       call _WinMain
       invoke ExitProcess,NULL
       end start    
  相关解决方案