一个CLASS中的变量竟然在最后面定义。 private double a;
private double b;
private double b;
梅尚程荀
马谭杨奚
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static int cxClient, cyClient; HDC hdc; int i; PAINTSTRUCT ps; POINT apt[NUM]; RECT rect; switch(message) { case WM_CREATE: PlaySound(TEXT("SystemStart"), NULL, SND_FILENAME | SND_ASYNC); return 0; case WM_SIZE: cxClient = LOWORD(lParam); cyClient = HIWORD(lParam); return 0; case WM_PAINT: hdc = BeginPaint(hwnd, &ps); GetClientRect(hwnd, &rect); DrawText(hdc, TEXT("Hello, Windows program design!"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); for(i = 0; i < NUM; i++) { apt[i].x = i * cxClient; apt[i].y = i * cyClient; } Polyline(hdc, apt, NUM); EndPaint(hwnd, &ps); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd, message, wParam, lParam); }