ReactOS 0.4.15-dev-8236-g99f0937
ScrollBarWndExtra.c File Reference
#include "precomp.h"
Include dependency graph for ScrollBarWndExtra.c:

Go to the source code of this file.

Macros

#define BUILTIN_SCROLLBAR   "Scrollbar"
 
#define CUSTOM_SCROLLBAR   "MSScrollBarClass"
 

Functions

 START_TEST (ScrollBarWndExtra)
 

Macro Definition Documentation

◆ BUILTIN_SCROLLBAR

#define BUILTIN_SCROLLBAR   "Scrollbar"

Definition at line 13 of file ScrollBarWndExtra.c.

◆ CUSTOM_SCROLLBAR

#define CUSTOM_SCROLLBAR   "MSScrollBarClass"

Definition at line 14 of file ScrollBarWndExtra.c.

Function Documentation

◆ START_TEST()

START_TEST ( ScrollBarWndExtra  )

Definition at line 18 of file ScrollBarWndExtra.c.

19{
20 HWND hScrollBar;
21 HWND hScrollBarImpersonator;
23 ATOM ClassAtom;
24
25 LONG_PTR dummyData = (LONG_PTR)0xbeefbeefbeefbeefULL, result;
26 WNDPROC lpfnWndProc;
27 DWORD dwExtra;
28
29 hScrollBar = CreateWindowExA(0, BUILTIN_SCROLLBAR, "", WS_POPUP,
30 20, 20, 120, 120, NULL, 0, GetModuleHandle(NULL), 0);
31
32 ok(hScrollBar != NULL, "Scrollbar creation failed (%lu)\n", GetLastError());
33
34 lpfnWndProc = (WNDPROC)GetWindowLongPtrA(hScrollBar, GWL_WNDPROC);
35 dwExtra = GetClassLongPtrA(hScrollBar, GCL_CBWNDEXTRA);
36
37 ZeroMemory(&WndClass, sizeof(WndClass));
39 WndClass.lpfnWndProc = lpfnWndProc;
40 WndClass.cbWndExtra = dwExtra + sizeof(LONG_PTR);
41 WndClass.hInstance = GetModuleHandle(NULL);
43 WndClass.hbrBackground = GetStockObject(LTGRAY_BRUSH);
44 WndClass.lpszClassName = CUSTOM_SCROLLBAR;
45 ClassAtom = RegisterClassA(&WndClass);
46
47 ok(ClassAtom != 0, "RegisterClassA failed (%lu)\n", GetLastError());
48 DestroyWindow(hScrollBar);
49
50
51 hScrollBarImpersonator = CreateWindowExA(0, CUSTOM_SCROLLBAR, "", WS_POPUP,
52 20, 20, 120, 120, NULL, 0, GetModuleHandle(NULL), 0);
53 ok(hScrollBarImpersonator != NULL, "Scrollbar creation failed (%lu)\n", GetLastError());
54
55 SetWindowLongPtrA(hScrollBarImpersonator, dwExtra, dummyData);
56 result = GetWindowLongPtrA(hScrollBarImpersonator, dwExtra);
57 ok(result == dummyData, "Invalid dummyData\n");
58
59 DestroyWindow(hScrollBarImpersonator);
61}
#define CUSTOM_SCROLLBAR
#define BUILTIN_SCROLLBAR
#define ok(value,...)
Definition: atltest.h:57
WCHAR WndClass[]
Definition: capicon.c:23
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint64EXT * result
Definition: glext.h:11304
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_POPUP
Definition: pedump.c:616
#define LONG_PTR
Definition: treelist.c:79
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetModuleHandle
Definition: winbase.h:3827
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define LTGRAY_BRUSH
Definition: wingdi.h:900
#define CS_VREDRAW
Definition: winuser.h:658
#define SetWindowLongPtrA
Definition: winuser.h:5354
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define GWL_WNDPROC
Definition: winuser.h:853
#define GetWindowLongPtrA
Definition: winuser.h:4828
#define CS_DBLCLKS
Definition: winuser.h:651
#define GCL_CBWNDEXTRA
Definition: winuser.h:663
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define LoadCursor
Definition: winuser.h:5821
#define GetClassLongPtrA
Definition: winuser.h:4563
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define CS_PARENTDC
Definition: winuser.h:656
BOOL WINAPI DestroyWindow(_In_ HWND)