ITMISS
#include #include LRESULT CALLBACK WinProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);POINT pt={0,0};int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ){HWND hwnd;MSG msg;BOOL bRet;WNDCLASS wndcls;wndcls.style=CS_HREDRAW|CS_VREDRAW;wndcls.lpfnWndProc=WinProc;wndcls.cbClsExtra=0;wndcls.cbWndExtra=0;wndcls.lpszClassName=TEXT("wjbxngx");wndcls.lpszMenuName=NULL;wndcls.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);wndcls.hIcon=LoadIcon(NULL,IDI_ERROR);wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);wndcls.hInstance=hInstance;RegisterClass(&wndcls);hwnd=CreateWindow(TEXT("wjbxngx"),TEXT("示例"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,600,400,NULL,NULL,hInstance,NULL);ShowWindow(hwnd,SW_SHOWNORMAL);UpdateWindow(hwnd);while ((bRet=GetMessage(&msg,hwnd,0,0))!=0){if (bRet==-1){return -1;}else{TranslateMessage(&msg);DispatchMessage(&msg);}}return msg.wParam;}LRESULT CALLBACK WinProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){HDC hdc;TCHAR szChar[20];PAINTSTRUCT ps;switch(uMsg){case WM_LBUTTONDOWN:pt.x=LOWORD(lParam);pt.y=HIWORD(lParam);break;case WM_RBUTTONDOWN:InvalidateRect(hwnd,NULL,TRUE);break;case WM_MOUSEMOVE:if (wParam&MK_LBUTTON){hdc=GetDC(hwnd);MoveToEx(hdc,pt.x,pt.y,NULL);LineTo(hdc,LOWORD(lParam),HIWORD(lParam));pt.x=LOWORD(lParam);pt.y=HIWORD(lParam);ReleaseDC(hwnd,hdc);}break;case WM_PAINT:hdc=BeginPaint(hwnd,&ps);EndPaint(hwnd,&ps);break;case WM_CLOSE:if (IDYES==MessageBox(hwnd,TEXT("真的要退出吗?"),TEXT("信息"),MB_YESNO)){DestroyWindow(hwnd);}break;case WM_DESTROY:PostQuitMessage(0);break;default:return DefWindowProc(hwnd,uMsg,wParam,lParam);}return 0;}