ReactOS 0.4.15-dev-7924-g5949c20
PaintDesktop.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: rostests/win32/user32/paintdesktop/PaintDesktop.c
5 *
6 * PURPOSE: Demonstrates how the user32!PaintDesktop() API visually works.
7 * This API paints the desktop inside the given HDC with its
8 * origin always fixed to the origin of the monitor on which
9 * the window is present.
10 *
11 * PROGRAMMER: Hermes Belusca-Maito
12 */
13
14#define WIN32_LEAN_AND_MEAN
15#include <windows.h>
16
18static PWSTR szTitle = L"PaintDesktop";
19static PWSTR szWindowClass = L"PAINTDESKTOP";
20
24
26 HINSTANCE hPrevInstance,
27 LPWSTR lpCmdLine,
28 int nCmdShow)
29{
30 MSG msg;
31
32 UNREFERENCED_PARAMETER(hPrevInstance);
33 UNREFERENCED_PARAMETER(lpCmdLine);
34
36
37 if (!InitInstance (hInstance, nCmdShow))
38 return FALSE;
39
40 while (GetMessage(&msg, NULL, 0, 0))
41 {
44 }
45
46 return (int) msg.wParam;
47}
48
50{
51 WNDCLASS wc;
52
53 wc.style = 0;
55 wc.cbClsExtra = 0;
56 wc.cbWndExtra = 0;
60 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
61 wc.lpszMenuName = NULL;
63
64 return RegisterClass(&wc);
65}
66
68{
69 HWND hWnd;
70
72
75 if (!hWnd)
76 return FALSE;
77
78 ShowWindow(hWnd, nCmdShow);
80
81 return TRUE;
82}
83
85{
86 switch (message)
87 {
88 case WM_MOVE:
91 break;
92
93 case WM_ERASEBKGND:
95
96 case WM_DESTROY:
98 break;
99
100 default:
102 }
103
104 return 0;
105}
static HINSTANCE hInst
Definition: PaintDesktop.c:17
BOOL InitInstance(HINSTANCE, int)
Definition: PaintDesktop.c:67
static PWSTR szWindowClass
Definition: PaintDesktop.c:19
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
Definition: PaintDesktop.c:25
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM)
Definition: PaintDesktop.c:84
ATOM MyRegisterClass(HINSTANCE hInstance)
Definition: PaintDesktop.c:49
static PWSTR szTitle
Definition: PaintDesktop.c:18
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
#define CALLBACK
Definition: compat.h:35
unsigned int BOOL
Definition: ntddk_ex.h:94
static HDC
Definition: imagelist.c:92
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define DefWindowProc
Definition: ros2win.h:31
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
Definition: tftpd.h:60
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint16_t * PWSTR
Definition: typedefs.h:56
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_ERASEBKGND
Definition: winuser.h:1625
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_WINDOW
Definition: winuser.h:918
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI PaintDesktop(_In_ HDC)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2105
#define IDI_WINLOGO
Definition: winuser.h:709
#define CreateWindow
Definition: winuser.h:5754
#define GetMessage
Definition: winuser.h:5790
BOOL WINAPI UpdateWindow(_In_ HWND)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WM_MOVE
Definition: winuser.h:1610
#define RegisterClass
Definition: winuser.h:5836
#define WM_DESTROY
Definition: winuser.h:1609
#define DispatchMessage
Definition: winuser.h:5765
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2075
WCHAR * LPWSTR
Definition: xmlstorage.h:184