当前位置:编程学习 > 汇编语言 >>

汇编入门程序的问题

include user32.inc include kernel32.inc include windows.inc include gdi32.inc includelib user32.lib includelib kernel32.lib includelib gdi32.lib ;myFirstApp头文件 .386 .model flat,stdcall option casemap:none include myFirstApp.inc .data? hInstance dd ? hWinMain 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:HDC mov eax,uMsg .if eax == WM_PAINT invoke BeginPaint,hWnd,addr @stPs mov @hDC,eax invoke GetClientRect,hWnd,addr @stRect invoke DrawText,addr @hDC,offset szText,-1,addr @stRect,DT_SINGLELINE or DT_CENTER or DT_VCENTER invoke EndPaint,hWnd,addr @stPs .elseif eax == WM_CLOSE invoke DestroyWindow,hWnd invoke PostQuitMessage,0 .else invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .endif xor eax,eax ret _ProcWinMain endp _WinMain 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 mov @stWndClass.cbSize,sizeof WNDCLASS mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW mov @stWndClass.lpfnWndProc,offset _ProcWinMain ; mov @stWndClass.hInstance,hInstance ;个人测试代码 push hInstance pop @stWndClass.hInstance mov @stWndClass.hbrBackground,COLOR_WINDOW + 1 mov @stWndClass.lpszClassName,offset szClassName invoke RegisterClassEx,addr @stWndClass invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szCaptionMain,WS_OVERLAPPEDWINDOW,\ 100,100,600,400,NULL,NULL,hInstance,NULL mov hWinMain,eax invoke ShowWindow,hWinMain,SW_SHOWNORMAL invoke UpdateWindow,hWinMain .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 ;源文件
补充:这程序可以运行起来,但就是窗口不显示。也就是说进程里有,但没窗口显示。求找错误。谢谢
 
我自己找到错误了。分不浪费,送分给一楼的。随便回答个什么就行了,我送分。
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,