|
楼主 |
发表于 2014-10-12 08:45:25
|
显示全部楼层
我给您看下完整的代码:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
include gdi32.inc
includelib gdi32.lib
include shell32.inc
includelib shell32.lib
.data?
hIstance dd ?
hMainIstance dd ?
.const
szMyClass db'my class',0
szName db'我的窗口',0
szLpName db'欢迎来到我的窗口',0
szButton db'button',0
szbuttontext db'鱼c',0
szopen db'open',0
szwenjian db'http://www.fishc.com'
.code
_mainproc 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 szLpName ,-1,addr @strect,\
DT_SINGLELINE or DT_CENTER or DT_VCENTER
invoke EndPaint,hWnd,addr @stps
.elseif eax ==WM_COMMAND
mov eax,wParam
.if eax == IDOK
invoke ShellExecute,NULL,offset szopen,offset
szwenjian,NULL,NULL,SW_SHOWNORMAL
.endif
.elseif eax == WM_CREATE
invoke CreateWindowEx,NULL,offset szButton,offset szbuttontext,WS_CHILD or WS_VISIBLE,\
200,250,88,22,hWnd,1,hIstance,NULL
.elseif eax == WM_CLOSE
invoke DestroyWindow,hMainIstance
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
_mainproc endp
_winmain proc
local @stWndClass:WNDCLASSEX
local @stMsg:MSG
invoke GetModuleHandle,NULL
mov hIstance,eax
invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
invoke LoadCursor,0,IDC_ARROW
mov @stWndClass.hCursor,eax
push hIstance
pop @stWndClass.hInstance
mov @stWndClass.cbSize,sizeof WNDCLASSEX
mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW
mov @stWndClass.hbrBackground,COLOR_WINDOW + 1
mov @stWndClass.lpszClassName,offset szMyClass
mov @stWndClass.lpfnWndProc,offset _mainproc
invoke RegisterClassEx,addr @stWndClass
invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szMyClass,\
offset szName,WS_OVERLAPPEDWINDOW,100,100,600,400,\
NULL,NULL,hIstance,NULL
mov hMainIstance,eax
invoke ShowWindow,hMainIstance,SW_SHOWNORMAL
invoke UpdateWindow,hMainIstance
.while TRUE
invoke GetMessage,addr @stMsg,NULL,0,0
.break .if eax == 0
invoke TranslateMessage,addr @stMsg
invoke DispatchMessage,addr @stMsg
.endw
ret
_winmain endp
start:
call _winmain
invoke ExitProcess,NULL
end start
我格式修改了下,但是没完全弄好,请帮我在看下。第二个问题。谢谢 |
评分
-
查看全部评分
|