ReactOS  0.4.14-dev-315-gbb6fece
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);
42  WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
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 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define LONG_PTR
Definition: treelist.c:79
WORD ATOM
Definition: dimm.idl:113
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1642
#define CS_HREDRAW
Definition: winuser.h:648
BOOL WINAPI DestroyWindow(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
#define LTGRAY_BRUSH
Definition: wingdi.h:899
#define GetWindowLongPtrA
Definition: winuser.h:4729
#define CS_VREDRAW
Definition: winuser.h:653
#define GCL_CBWNDEXTRA
Definition: winuser.h:658
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetWindowLongPtrA
Definition: winuser.h:5246
#define CS_DBLCLKS
Definition: winuser.h:646
#define CUSTOM_SCROLLBAR
#define LoadCursor
Definition: winuser.h:5713
#define BUILTIN_SCROLLBAR
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
#define GetModuleHandle
Definition: winbase.h:3651
#define ok(value,...)
Definition: atltest.h:57
#define GWL_WNDPROC
Definition: winuser.h:847
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_POPUP
Definition: pedump.c:616
#define IDC_ARROW
Definition: winuser.h:682
#define GetClassLongPtrA
Definition: winuser.h:4464
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)
GLuint64EXT * result
Definition: glext.h:11304
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define CS_PARENTDC
Definition: winuser.h:651
WCHAR WndClass[]
Definition: capicon.c:23