mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
[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...
svn path=/trunk/; revision=71622
This commit is contained in:
parent
0301f591be
commit
ac4a897155
3 changed files with 108 additions and 0 deletions
|
@ -1 +1,2 @@
|
|||
add_subdirectory(paintdesktop)
|
||||
add_subdirectory(sysicon)
|
||||
|
|
5
rostests/win32/user32/paintdesktop/CMakeLists.txt
Normal file
5
rostests/win32/user32/paintdesktop/CMakeLists.txt
Normal file
|
@ -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)
|
102
rostests/win32/user32/paintdesktop/PaintDesktop.c
Normal file
102
rostests/win32/user32/paintdesktop/PaintDesktop.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue