我运行一次,然后关掉,再编译运行,为什么我在进程还看得到WINMAIN.EXE 的进程,也就是这个程序的进程,为什么,是不是消息没关掉,哪位大哥帮我看看,谢谢
代码如下:
#include <windows.h>
#include <stdio.h>LRESULT CALLBACK WinSunProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
);
int WINAPI WinMain(
  HINSTANCE hInstance,  // handle to current instance
  HINSTANCE hPrevInstance,  // handle to previous instance
  LPSTR lpCmdLine,      // pointer to command line
  int nCmdShow          // show state of window
)
{
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.hCursor= LoadCursor(NULL,IDC_CROSS);
wndclass.hIcon = LoadIcon(NULL,IDI_ERROR);
wndclass.hInstance = hInstance;
wndclass.lpfnWndProc = WinSunProc;
wndclass.lpszClassName = "rjm2050";
wndclass.lpszMenuName = NULL;
wndclass.style = CS_VREDRAW |CS_HREDRAW;
RegisterClass(&wndclass); HWND hwnd;
hwnd = CreateWindow("rjm2050",NULL,WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd); MSG msg;
while(GetMessage(&msg,hwnd,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;}
LRESULT CALLBACK WinSunProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
)
{
switch(uMsg)
{
case WM_CHAR:
char szchar[20];
sprintf(szchar,"the char is %d ",wParam);
MessageBox(hwnd,szchar,"Key",MB_OK);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"mouse clicked","message",0);
HDC hDC;
hDC = GetDC(hwnd);
TextOut(hDC,0,50,"鼠标电击",strlen("鼠标电击"));
ReleaseDC(hwnd,hDC);
break;
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd,&ps);
TextOut(hdc,0,0,"RJM2050WIN32测试",strlen("RJM2050WIN32测试"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if(IDYES == MessageBox(hwnd,"是否真的要退出吗?","message",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}