Author: hbelusca Date: Sun Jun 12 14:34:58 2016 New Revision: 71622
URL: http://svn.reactos.org/svn/reactos?rev=71622&view=rev Log: [ROSTESTS:USER32] Add an interactive test demonstrating how the PaintDesktop API should behave visually, and how we are not correctly doing well in this regard in ReactOS...
Added: trunk/rostests/win32/user32/paintdesktop/ trunk/rostests/win32/user32/paintdesktop/CMakeLists.txt (with props) trunk/rostests/win32/user32/paintdesktop/PaintDesktop.c (with props) Modified: trunk/rostests/win32/user32/CMakeLists.txt
Modified: trunk/rostests/win32/user32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/win32/user32/CMakeLists.tx... ============================================================================== --- trunk/rostests/win32/user32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/win32/user32/CMakeLists.txt [iso-8859-1] Sun Jun 12 14:34:58 2016 @@ -1 +1,2 @@ +add_subdirectory(paintdesktop) add_subdirectory(sysicon)
Added: trunk/rostests/win32/user32/paintdesktop/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/win32/user32/paintdesktop/... ============================================================================== --- trunk/rostests/win32/user32/paintdesktop/CMakeLists.txt (added) +++ trunk/rostests/win32/user32/paintdesktop/CMakeLists.txt [iso-8859-1] Sun Jun 12 14:34:58 2016 @@ -0,0 +1,5 @@ + +add_executable(paintdesktop PaintDesktop.c) +set_module_type(paintdesktop win32gui UNICODE) +add_importlibs(paintdesktop user32 msvcrt kernel32) +add_cd_file(TARGET paintdesktop DESTINATION reactos/bin FOR all)
Propchange: trunk/rostests/win32/user32/paintdesktop/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/win32/user32/paintdesktop/PaintDesktop.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/win32/user32/paintdesktop/... ============================================================================== --- trunk/rostests/win32/user32/paintdesktop/PaintDesktop.c (added) +++ trunk/rostests/win32/user32/paintdesktop/PaintDesktop.c [iso-8859-1] Sun Jun 12 14:34:58 2016 @@ -0,0 +1,102 @@ +/* + * PaintDesktop.c + * + * Demonstrates how the user32!PaintDesktop() API visually works. + * This API paints the desktop inside the given HDC with its origin + * always fixed to the origin of the monitor on which the window is + * present. + */ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +static HINSTANCE hInst; +static PWSTR szTitle = L"PaintDesktop"; +static PWSTR szWindowClass = L"PAINTDESKTOP"; + +ATOM MyRegisterClass(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); + +int APIENTRY wWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPWSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + MyRegisterClass(hInstance); + + if (!InitInstance (hInstance, nCmdShow)) + return FALSE; + + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return (int) msg.wParam; +} + +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIconW(NULL, IDI_WINLOGO); + wc.hCursor = LoadCursorW(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szWindowClass; + + return RegisterClass(&wc); +} + +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + + hInst = hInstance; + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + if (!hWnd) + return FALSE; + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_MOVE: + InvalidateRect(hWnd, NULL, TRUE); + UpdateWindow(hWnd); + break; + + case WM_ERASEBKGND: + PaintDesktop((HDC)wParam); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; +}
Propchange: trunk/rostests/win32/user32/paintdesktop/PaintDesktop.c ------------------------------------------------------------------------------ svn:eol-style = native