#include #include #include static LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC hDC; LRESULT Result; RECT rc; switch(msg) { case WM_DESTROY: PostQuitMessage(0); Result = 0; break; case WM_NCPAINT: printf("received WM_NCPAINT\n"); Result = DefWindowProc(hWnd, msg, wParam, lParam); break; case WM_PAINT: printf("Before GetUpdateRect\n"); GetUpdateRect(hWnd, &rc, TRUE); printf("After GetUpdateRect\n"); hDC = BeginPaint(hWnd, &ps); EndPaint (hWnd, &ps); Result = 0; break; case WM_LBUTTONDOWN: RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME); Result = 0; break; default: Result = DefWindowProc(hWnd, msg, wParam, lParam); break; } return Result; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { WNDCLASS wc; MSG msg; HWND hWnd; wc.lpszClassName = "GurTestClass"; wc.lpfnWndProc = MainWndProc; wc.style = CS_VREDRAW | CS_HREDRAW; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, (LPCTSTR) IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, (LPCTSTR) IDC_ARROW); wc.hbrBackground = (HBRUSH) GetStockObject(GRAY_BRUSH); wc.lpszMenuName = NULL; wc.cbClsExtra = 0; wc.cbWndExtra = 0; if (RegisterClass(&wc) == 0) { fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", GetLastError()); return(1); } hWnd = CreateWindow(_T("GurTestClass"), _T("ReactOS test"), WS_OVERLAPPEDWINDOW, 0, //Position; you can use CW_USEDEFAULT, too 0, 600, //height 400, NULL, NULL, hInstance, NULL); if (hWnd == NULL) { fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", GetLastError()); return(1); } ShowWindow(hWnd, nCmdShow); while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; }