年
年轻和尚
Unregistered / Unconfirmed
GUEST, unregistred user!
#include<windows.h><br>HWND hWnd;<br>HINSTANCE hInstance;<br><br>LRESULT APIENTRY WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)<br>{<br> switch(message)<br> {<br> case WM_CLOSE:<br> ShowWindow(hWnd,SW_HIDE);<br> PostQuitMessage(0);<br> return 0;<br><br> default:<br> return DefWindowProc(hWnd,message,wParam,lParam);<br> }<br>}<br><br>int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)<br>{<br> WNDCLASS WinClass;<br> MSG msg;<br> <br> WinClass.cbClsExtra=0;<br> WinClass.cbWndExtra=0;<br> WinClass.lpszMenuName=NULL;<br> WinClass.hCursor=LoadCursor(0,IDC_ARROW);<br> WinClass.hIcon=LoadIcon(0,IDI_APPLICATION);<br> WinClass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);<br> WinClass.lpfnWndProc=WndProc;<br> WinClass.lpszClassName="S";<br> WinClass.hInstance=hInstance;<br> WinClass.style=CS_OWNDC;<br><br> RegisterClass(&WinClass);<br> <br> hWnd=CreateWindow(<br> "S",<br> "S-Window",<br> WS_TILEDWINDOW|WS_VISIBLE,<br> 100,200,<br> 600,400,<br> 0,0,<br> hInstance,<br> NULL);<br><br> ShowWindow(hWnd,SW_SHOW);<br> UpdateWindow(hWnd);<br><br> while(GetMessage(&msg,hWnd,0,0))<br> {<br> TranslateMessage(&msg);<br> DispatchMessage(&msg);<br> <br> return msg.wParam;<br> }<br><br> return 0;<br>}<br>为啥我一移上鼠标,或者此窗体收到任何消息,都会自动关闭????<br>