1.
代码是照<<Windows32位汇编语言程序设计这本书>>打的,编译没错,可是没有结果?
.386
.model flat, stdcall
option casemap :none
include /masm32/include/windows.inc
include /masm32/include/user32.inc
includelib /masm32/lib/user32.lib
include /masm32/include/kernel32.inc
includelib /masm32/lib/kernel32.lib
include /masm32/include/gdi32.inc
includelib /masm32/lib/gdi32.lib
.data?
hInstancedd?
hWndMain dd ?
.const
szClassName db 'MyClass',0
szCaptionMain db 'My first Window !',0
szText db 'Win32 Assembly,Simple and powerful !',0
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;窗口过程
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcWinMain proc uses ebx edi esi, hWnd,uMsg,wParam,lParam
local @stPs:PAINTSTRUCT
local @stRect:RECT
local @hDc
mov eax,uMsg
;*********************************************************
.if eax == WM_PAINT
invoke BeginPaint,hWnd,addr @stPs
mov @hDc,eax
invoke GetClientRect,hWnd,addr @stRect
invoke DrawText,@hDc,addr szText,-1,\
addr @stRect,\
DT_SINGLELINE or DT_CENTER or DT_VCENTER
invoke EndPaint,hWnd,addr @stPs
.elseif eax == WM_CLOSE
invoke DestroyWindow,hWndMain
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
_ProcWinMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_WndMain proc
local @stWndClass : WNDCLASSEX
local @stMsg : MSG
invoke GetModuleHandle,NULL
mov hInstance , eax
invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
;**********************************************************************
;注册窗口类
;**********************************************************************
invoke LoadCursor , 0 , IDC_ARROW
mov @stWndClass.hCursor,eax
push hInstance
pop @stWndClass.hInstance
mov @stWndClass.cbSize,sizeof WNDCLASSEX
mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW
mov @stWndClass.lpfnWndProc,offset _ProcWinMain
mov @stWndClass.lpszClassName,offset szClassName
invoke RegisterClassEx,addr @stWndClass
;**********************************************************
;建立并显示窗口
;**********************************************************
invokeCreateWindowEx,WS_EX_CLIENTEDGE,\
offset szClassName,offset szCaptionMain,\
WS_OVERLAPPEDWINDOW OR WS_VSCROLL OR WS_HSCROLL,\
100,100,550,400,\
NULL,NULL,hInstance,NULL
invokeShowWindow,hWndMain,SW_SHOWNORMAL
invokeUpdateWindow,hWndMain
;***********************************************************
;消息循环
;***********************************************************
.while TRUE
invokeGetMessage,addr @stMsg,NULL,0,0
.break.if eax== 0
invokeTranslateMessage,addr @stMsg
invokeDispatchMessage,addr @stMsg
.endw
ret
_WndMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start: call _WndMain
invoke ExitProcess,NULL
end start
endstart
2.
qeditor.exe 怎么查看 行号?
谢谢
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!