这个Win32程序为什么没弹出窗口啊?
Win32汇编刚接触,感觉一开始好困难啊,下面的程序基本和书上的例子相同,怎么就没弹出窗口呢?纳闷啊麻烦哪位给看看
程序代码:
.386 .model flat, stdcall option casemap:none _WinMain proto :DWORD, :DWORD, :DWORD, :DWORD include windows.inc include user32.inc includelib user32.lib include kernel32.inc includelib kernel32.lib include gdi32.inc includelib gdi32.inc .data className BYTE "My class",0 TextString BYTE "I have paint teh text successfully!",0 classCaptin BYTE "This is captin.",0 .data? hinstance DWORD ? hWinMain DWORD ? .code start: invoke GetModuleHandle,NULL mov hinstance,eax invoke _WinMain,hinstance,NULL,NULL,SW_NORMAL invoke ExitProcess,0 _WinMain proc hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR, CmdShow:DWORD local ms:MSG local wc:WNDCLASSEX local hWnd:DWORD ;填充wc mov wc.cbSize,SIZEOF WNDCLASSEX mov wc.style, CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndProc, OFFSET WndProc mov wc.cbClsExtra,NULL mov wc.cbWndExtra,NULL push hInst pop wc.hInstance mov wc.hbrBackground,COLOR_WINDOW+1 mov wc.lpszMenuName,NULL mov wc.lpszClassName,OFFSET className invoke LoadIcon,NULL,IDI_APPLICATION;加载窗口最左上方的图标,若第一个为NULL则加载Windows自定义的 mov wc.hIcon,eax mov wc.hIconSm,eax invoke LoadCursor,NULL,IDC_APPSTARTING mov wc.hCursor,eax ;注册新窗口 invoke RegisterClassEx,addr wc ;创建窗口 invoke CreateWindowEx,WS_EX_CLIENTEDGE,addr className,addr classCaptin,WS_ACTIVECAPTION,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInst,NULL mov hWnd,eax ;显示窗口 invoke ShowWindow,hWnd,SW_SHOWNORMAL ;更新窗口 invoke UpdateWindow,hWnd ;消息循环 .while TRUE invoke GetMessage,addr ms,hWnd,0,0 ;当检索到消息WM_QUIT时,GetMessage的返回值为0 .break .if(!eax) invoke TranslateMessage,addr ms invoke DispatchMessage,addr ms .endw ret _WinMain endp ;窗口过程 WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM local hdc:DWORD local ps:PAINTSTRUCT local rectage:RECT mov eax,uMsg .if eax==WM_DESTROY invoke PostQuitMessage,0 .elseif eax==WM_PAINT invoke BeginPaint,NULL,addr ps mov hdc,eax invoke GetClientRect,hWnd,addr rectage invoke DrawText,hdc,addr TextString,-1,addr rectage,DT_SINGLELINE or DT_VCENTER or DT_CENTER invoke EndPaint,hdc,addr ps .else invoke DefWindowProc,hWnd,WM_ACTIVATE,wParam,lParam ret .endif xor eax,eax ret WndProc endp end start