ReactOS 0.4.15-dev-8245-gd24675b
buttonvistest.cpp File Reference
#include <windows.h>
#include <uxtheme.h>
#include <stdlib.h>
#include <tchar.h>
#include "resource.h"
Include dependency graph for buttonvistest.cpp:

Go to the source code of this file.

Macros

#define TOP_MARGIN   50
 
#define LEFT_MARGIN   160
 
#define X_GAP   10
 
#define Y_GAP   10
 
#define Y_HEIGHT   40
 
#define X_WIDTH   150
 

Functions

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM)
 
static void RegisterMyClass (HINSTANCE hInst)
 
static HWND CreateWnd (HWND hWnd, LPCWSTR Class, LPCWSTR Text, LONG style, int i, int j)
 
static HWND CreateBtn (HWND hWnd, LPCWSTR Text, LONG style, int i, int j)
 
static void CreateButtonSet (HWND hwndParent, HWND *ahwnd, int i, int j, DWORD style)
 
int WINAPI wWinMain (_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
 
static VOID OnScroll (HWND hwnd, INT nBar, WORD sbCode)
 

Variables

HICON hico
 
HBITMAP hbmp
 
HIMAGELIST himl
 
POINT scPos
 
HBRUSH hbrNULL
 
HBRUSH hbrRed
 
HBRUSH hbrGreen
 
HBRUSH hbrBlue
 
HBRUSH hbrCyan
 
HBRUSH hbrYellow
 
HBRUSH hbrCtlColorStatic
 
HBRUSH hbrCtlColorBtn
 
HBRUSH hbrPrintClientClear
 
HBRUSH hbrErase
 
BOOL bSkipErase
 
BOOL bSkipPaint
 

Macro Definition Documentation

◆ LEFT_MARGIN

#define LEFT_MARGIN   160

Definition at line 51 of file buttonvistest.cpp.

◆ TOP_MARGIN

#define TOP_MARGIN   50

Definition at line 50 of file buttonvistest.cpp.

◆ X_GAP

#define X_GAP   10

Definition at line 52 of file buttonvistest.cpp.

◆ X_WIDTH

#define X_WIDTH   150

Definition at line 55 of file buttonvistest.cpp.

◆ Y_GAP

#define Y_GAP   10

Definition at line 53 of file buttonvistest.cpp.

◆ Y_HEIGHT

#define Y_HEIGHT   40

Definition at line 54 of file buttonvistest.cpp.

Function Documentation

◆ CreateBtn()

static HWND CreateBtn ( HWND  hWnd,
LPCWSTR  Text,
LONG  style,
int  i,
int  j 
)
static

Definition at line 69 of file buttonvistest.cpp.

70{
71 WCHAR buffer[100];
72 SIZE s;
73
74 HWND ret = CreateWnd(hWnd, L"Button", Text, style, i, j);
76 {
77 swprintf(buffer, L"expected 0x%x got 0x%x", (style | WS_CHILD | WS_VISIBLE), GetWindowLongW(ret, GWL_STYLE));
78 MessageBox(0, buffer, L"error", MB_OK);
79 }
80
82 {
83 swprintf(buffer, L"%s (%d, %d)", Text, s.cx, s.cy);
85 }
86 return ret;
87}
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
static HWND CreateWnd(HWND hWnd, LPCWSTR Class, LPCWSTR Text, LONG style, int i, int j)
char * Text
Definition: combotst.c:136
#define swprintf
Definition: precomp.h:40
GLdouble s
Definition: gl.h:2039
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define BCM_GETIDEALSIZE
Definition: commctrl.h:4639
int ret
LONG_PTR LPARAM
Definition: windef.h:208
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define WM_SETTEXT
Definition: winuser.h:1617
#define MB_OK
Definition: winuser.h:790
#define MessageBox
Definition: winuser.h:5831
#define GWL_STYLE
Definition: winuser.h:852
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CreateButtonSet().

◆ CreateButtonSet()

static void CreateButtonSet ( HWND  hwndParent,
HWND ahwnd,
int  i,
int  j,
DWORD  style 
)
static

Definition at line 89 of file buttonvistest.cpp.

90{
91 ahwnd[0] = CreateBtn(hwndParent, L"TestButton", style, i, j + 0);
92 ahwnd[1] = CreateBtn(hwndParent, L"TestButton1", style, i, j + 1);
93 ahwnd[2] = CreateBtn(hwndParent, L"TestButton2", style, i, j + 2);
94 ahwnd[3] = CreateBtn(hwndParent, L"TestButton3", style | BS_BITMAP, i, j + 3);
95 ahwnd[4] = CreateBtn(hwndParent, L"TestButton4", style | BS_ICON, i, j + 4);
96
99
102}
static HWND CreateBtn(HWND hWnd, LPCWSTR Text, LONG style, int i, int j)
HBITMAP hbmp
HICON hico
static HWND hwndParent
Definition: cryptui.c:300
#define BS_BITMAP
Definition: winuser.h:258
#define IMAGE_BITMAP
Definition: winuser.h:211
#define IMAGE_ICON
Definition: winuser.h:212
#define BS_ICON
Definition: winuser.h:264
#define BM_SETIMAGE
Definition: winuser.h:1922

Referenced by wWinMain().

◆ CreateWnd()

static HWND CreateWnd ( HWND  hWnd,
LPCWSTR  Class,
LPCWSTR  Text,
LONG  style,
int  i,
int  j 
)
static

Definition at line 57 of file buttonvistest.cpp.

58{
59 return CreateWindowW(Class,
60 Text,
62 LEFT_MARGIN + (X_GAP + X_WIDTH) * i,
63 TOP_MARGIN + ((Y_GAP + Y_HEIGHT) *j),
64 X_WIDTH,
66 hWnd, NULL, NULL, NULL);
67}
#define TOP_MARGIN
#define X_WIDTH
#define Y_HEIGHT
#define Y_GAP
#define LEFT_MARGIN
#define X_GAP
#define NULL
Definition: types.h:112
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316

Referenced by CreateBtn(), and wWinMain().

◆ OnScroll()

static VOID OnScroll ( HWND  hwnd,
INT  nBar,
WORD  sbCode 
)
static

Definition at line 232 of file buttonvistest.cpp.

233{
234 RECT rect;
235
236 SCROLLINFO sInfo;
237 INT oldPos, Maximum;
238 PLONG pOriginXY;
239
240 //ASSERT(nBar == SB_HORZ || nBar == SB_VERT);
241
243
244 if (nBar == SB_HORZ)
245 {
246 Maximum =1000;//pData->cxMin - (rect.right-rect.left) /* pData->cxOld */;
247 pOriginXY = &scPos.x;
248 }
249 else // if (nBar == SB_VERT)
250 {
251 Maximum = 1000;//pData->cyMin - (rect.bottom-rect.top) /* pData->cyOld */;
252 pOriginXY = &scPos.y;
253 }
254
255 /* Set scrollbar sizes */
256 sInfo.cbSize = sizeof(sInfo);
258
259 if (!GetScrollInfo(hwnd, nBar, &sInfo))
260 return;
261
262 oldPos = sInfo.nPos;
263
264 switch (sbCode)
265 {
266 case SB_LINEUP: // SB_LINELEFT:
267 sInfo.nPos--;
268 break;
269
270 case SB_LINEDOWN: // SB_LINERIGHT:
271 sInfo.nPos++;
272 break;
273
274 case SB_PAGEUP: // SB_PAGELEFT:
275 sInfo.nPos -= sInfo.nPage;
276 break;
277
278 case SB_PAGEDOWN: // SB_PAGERIGHT:
279 sInfo.nPos += sInfo.nPage;
280 break;
281
282 case SB_THUMBTRACK:
283 sInfo.nPos = sInfo.nTrackPos;
284 break;
285
286 case SB_THUMBPOSITION:
287 sInfo.nPos = sInfo.nTrackPos;
288 break;
289
290 case SB_TOP: // SB_LEFT:
291 sInfo.nPos = sInfo.nMin;
292 break;
293
294 case SB_BOTTOM: // SB_RIGHT:
295 sInfo.nPos = sInfo.nMax;
296 break;
297
298 default:
299 break;
300 }
301
302 sInfo.nPos = min(max(sInfo.nPos, 0), Maximum);
303
304 if (oldPos != sInfo.nPos)
305 {
306 POINT scOldPos = scPos;
307
308 /* We now modify scPos */
309 *pOriginXY = sInfo.nPos;
310
312 (scOldPos.x - scPos.x),
313 (scOldPos.y - scPos.y),
314 NULL,
315 NULL,
316 NULL,
317 NULL,
319
320 sInfo.fMask = SIF_POS;
321 SetScrollInfo(hwnd, nBar, &sInfo, TRUE);
322 }
323}
POINT scPos
#define TRUE
Definition: types.h:120
#define min(a, b)
Definition: monoChain.cc:55
& rect
Definition: startmenu.cpp:1413
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define max(a, b)
Definition: svc.c:63
int32_t INT
Definition: typedefs.h:58
int32_t * PLONG
Definition: typedefs.h:58
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SB_THUMBTRACK
Definition: winuser.h:573
#define SB_LINEUP
Definition: winuser.h:564
#define SW_SCROLLCHILDREN
Definition: winuser.h:2578
#define SIF_RANGE
Definition: winuser.h:1235
#define SB_BOTTOM
Definition: winuser.h:577
#define SW_INVALIDATE
Definition: winuser.h:2579
#define SIF_PAGE
Definition: winuser.h:1233
#define SIF_TRACKPOS
Definition: winuser.h:1237
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_TOP
Definition: winuser.h:578
#define SIF_POS
Definition: winuser.h:1234
#define SW_ERASE
Definition: winuser.h:2580
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define SB_PAGEUP
Definition: winuser.h:568
#define SB_HORZ
Definition: winuser.h:552
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by WndProc().

◆ RegisterMyClass()

static void RegisterMyClass ( HINSTANCE  hInst)
static

Definition at line 29 of file buttonvistest.cpp.

30{
31 WNDCLASSEXW wcex;
32
33 wcex.cbSize = sizeof(WNDCLASSEX);
34
36 wcex.lpfnWndProc = WndProc;
37 wcex.cbClsExtra = 0;
38 wcex.cbWndExtra = 0;
39 wcex.hInstance = hInst;
42 wcex.hbrBackground = NULL;
44 wcex.lpszClassName = L"ButtonTests";
46
47 RegisterClassExW(&wcex);
48}
#define IDI_SMALL
Definition: resource.h:38
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM)
HINSTANCE hInst
Definition: dxdiag.c:13
#define IDC_MENU
Definition: resource.h:7
#define IDI_WIN32PROJECT1
Definition: resource.h:1
LPCWSTR lpszClassName
Definition: winuser.h:3226
LPCWSTR lpszMenuName
Definition: winuser.h:3225
HBRUSH hbrBackground
Definition: winuser.h:3224
WNDPROC lpfnWndProc
Definition: winuser.h:3218
UINT cbSize
Definition: winuser.h:3216
int cbWndExtra
Definition: winuser.h:3220
HCURSOR hCursor
Definition: winuser.h:3223
HICON hIconSm
Definition: winuser.h:3227
HINSTANCE hInstance
Definition: winuser.h:3221
UINT style
Definition: winuser.h:3217
int cbClsExtra
Definition: winuser.h:3219
HICON hIcon
Definition: winuser.h:3222
#define CS_VREDRAW
Definition: winuser.h:658
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define LoadIcon
Definition: winuser.h:5822
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define LoadCursor
Definition: winuser.h:5821
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5728
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by wWinMain().

◆ WndProc()

LRESULT CALLBACK WndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 325 of file buttonvistest.cpp.

326{
327 RECT rc = {0,0,5000,5000};
328 switch (message)
329 {
330 case WM_DESTROY:
332 break;
335 case WM_CTLCOLORBTN:
336 return (LRESULT)hbrCtlColorBtn;
337 case WM_ERASEBKGND:
338 FillRect((HDC)wParam, &rc, hbrErase);
339 return TRUE;
340 case WM_PRINTCLIENT:
342 break;
343 case WM_HSCROLL:
345 break;
346 case WM_VSCROLL:
348 break;
349 case WM_DRAWITEM :
350 {
352 INT oldBkMode;
355 oldBkMode = SetBkMode(di->hDC, TRANSPARENT);
356 DrawTextW(di->hDC, L"Ownder drawn text", -1, &di->rcItem, DT_VCENTER | DT_CENTER);
357 SetBkMode(di->hDC, oldBkMode);
358 break;
359 }
360 case WM_NOTIFY:
361 {
362 NMHDR* phdr = (NMHDR*)lParam;
363 if (phdr->code == NM_CUSTOMDRAW)
364 {
365 LPNMCUSTOMDRAW lpNMCustomDraw = (LPNMCUSTOMDRAW) lParam;
366 if (lpNMCustomDraw->dwDrawStage == CDDS_PREERASE && bSkipErase)
367 return CDRF_SKIPDEFAULT;
368 else if (lpNMCustomDraw->dwDrawStage == CDDS_PREPAINT && bSkipPaint)
369 return CDRF_SKIPDEFAULT;
370 return CDRF_DODEFAULT;
371 }
372 }
373 case WM_COMMAND:
374 {
375 UINT id = LOWORD(wParam);
376 switch(id)
377 {
378 case IDM_NULL_WIN: hbrErase = hbrNULL; break;
379 case IDM_RED_WIN: hbrErase = hbrRed; break;
380 case IDM_GREEN_WIN: hbrErase = hbrGreen; break;
381 case IDM_BLUE_WIN: hbrErase = hbrBlue; break;
382 case IDM_YELLOW_WIN: hbrErase = hbrYellow; break;
383 case IDM_CYAN_WIN: hbrErase = hbrCyan; break;
384
391
392 case IDM_NULL_BTN: hbrCtlColorBtn = hbrNULL; break;
393 case IDM_RED_BTN: hbrCtlColorBtn = hbrRed; break;
395 case IDM_BLUE_BTN: hbrCtlColorBtn = hbrBlue; break;
397 case IDM_CYAN_BTN: hbrCtlColorBtn = hbrCyan; break;
398
405
406 case IDM_SKIP_ERASE: bSkipErase = !bSkipErase; break;
407 case IDM_SKIP_PAINT: bSkipPaint = !bSkipPaint; break;
408 default:
409 return 0;
410 }
411
413 break;
414 }
415 default:
417 }
418 return 0;
419}
static int state
Definition: maze.c:121
BOOL bSkipErase
HBRUSH hbrNULL
HBRUSH hbrCtlColorBtn
HBRUSH hbrGreen
HBRUSH hbrCtlColorStatic
HBRUSH hbrPrintClientClear
HBRUSH hbrErase
HBRUSH hbrCyan
BOOL bSkipPaint
HBRUSH hbrRed
HBRUSH hbrYellow
HBRUSH hbrBlue
static VOID OnScroll(HWND hwnd, INT nBar, WORD sbCode)
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define IDM_SKIP_ERASE
Definition: resource.h:37
#define IDM_RED_WIN
Definition: resource.h:10
#define IDM_CYAN_STATIC
Definition: resource.h:21
#define IDM_CYAN_BTN
Definition: resource.h:28
#define IDM_GREEN_WIN
Definition: resource.h:11
#define IDM_BLUE_PRINTCLNT
Definition: resource.h:33
#define IDM_SKIP_PAINT
Definition: resource.h:38
#define IDM_CYAN_PRINTCLNT
Definition: resource.h:35
#define IDM_BLUE_STATIC
Definition: resource.h:19
#define IDM_NULL_WIN
Definition: resource.h:9
#define IDM_YELLOW_BTN
Definition: resource.h:27
#define IDM_YELLOW_STATIC
Definition: resource.h:20
#define IDM_GREEN_BTN
Definition: resource.h:25
#define IDM_NULL_PRINTCLNT
Definition: resource.h:30
#define IDM_NULL_STATIC
Definition: resource.h:16
#define IDM_RED_STATIC
Definition: resource.h:17
#define IDM_NULL_BTN
Definition: resource.h:23
#define IDM_CYAN_WIN
Definition: resource.h:14
#define IDM_BLUE_BTN
Definition: resource.h:26
#define IDM_YELLOW_PRINTCLNT
Definition: resource.h:34
#define IDM_YELLOW_WIN
Definition: resource.h:13
#define IDM_RED_PRINTCLNT
Definition: resource.h:31
#define IDM_RED_BTN
Definition: resource.h:24
#define IDM_GREEN_STATIC
Definition: resource.h:18
#define IDM_GREEN_PRINTCLNT
Definition: resource.h:32
#define IDM_BLUE_WIN
Definition: resource.h:12
static HDC
Definition: imagelist.c:92
unsigned int UINT
Definition: ndis.h:50
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define LOWORD(l)
Definition: pedump.c:82
struct tagNMCUSTOMDRAWINFO * LPNMCUSTOMDRAW
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define CDDS_PREERASE
Definition: commctrl.h:282
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
Definition: tftpd.h:60
UINT code
Definition: winuser.h:3159
LONG_PTR LRESULT
Definition: windef.h:209
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1772
#define ODS_SELECTED
Definition: winuser.h:2545
#define WM_HSCROLL
Definition: winuser.h:1743
#define DT_CENTER
Definition: winuser.h:527
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define WM_VSCROLL
Definition: winuser.h:1744
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define SB_VERT
Definition: winuser.h:553
#define WM_COMMAND
Definition: winuser.h:1740
#define DFC_BUTTON
Definition: winuser.h:476
#define WM_DRAWITEM
Definition: winuser.h:1645
#define WM_CTLCOLORBTN
Definition: winuser.h:1769
#define DT_VCENTER
Definition: winuser.h:543
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define DFCS_PUSHED
Definition: winuser.h:503

Referenced by RegisterMyClass().

◆ wWinMain()

int WINAPI wWinMain ( _In_ HINSTANCE  hInstance,
_In_opt_ HINSTANCE  hPrevInstance,
_In_ LPWSTR  lpCmdLine,
_In_ int  nCmdShow 
)

Definition at line 104 of file buttonvistest.cpp.

108{
109 HWND hwnd[200];
110 HANDLE hActCtx;
112 BOOL bActivated;
113
114 ACTCTXW actctx = { sizeof(actctx) };
115 actctx.hModule = hInstance;
116 actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID| ACTCTX_FLAG_HMODULE_VALID;
117 actctx.lpResourceName = MAKEINTRESOURCEW(500);
118 hActCtx = CreateActCtxW(&actctx);
119
122
123 scPos.x = 0;
124 scPos.y = 0;
125
127 hbrRed = CreateSolidBrush(0x00000FF);
128 hbrGreen = CreateSolidBrush(0x0000FF00);
129 hbrBlue = CreateSolidBrush(0x00FF0000);
130 hbrCyan = CreateSolidBrush(0x00FFFF00);
131 hbrYellow = CreateSolidBrush(0x0000FFFF);
132
137
140
142
145
146 CreateWnd(hWnd, L"Static", L"no images", 0, -1, 0);
147 CreateWnd(hWnd, L"Static", L"with BM_SETIMAGE", 0, -1, 1);
148 CreateWnd(hWnd, L"Static", L"with BM_SETIMAGE", 0, -1, 2);
149 CreateWnd(hWnd, L"Static", L"with BM_SETIMAGE and BS_BITMAP", 0, -1, 3);
150 CreateWnd(hWnd, L"Static", L"with BM_SETIMAGE and BS_ICON", 0, -1, 4);
151
152 CreateWnd(hWnd, L"Static", L"Button V5", 0, 0, -1);
156 CreateButtonSet(hWnd, &hwnd[15], 1, 5, BS_GROUPBOX);
157 CreateButtonSet(hWnd, &hwnd[20], 0, 10, BS_CHECKBOX);
159
160 bActivated = ActivateActCtx(hActCtx, &cookie);
161 LoadLibraryW(L"comctl32.dll");
162
165
166 CreateWnd(hWnd, L"Static", L"Button V6 without themes", 0, 2, -1);
170 CreateButtonSet(hWnd, &hwnd[55], 3, 5, BS_GROUPBOX);
171 CreateButtonSet(hWnd, &hwnd[50], 2, 10, BS_CHECKBOX);
173
174 CreateWnd(hWnd, L"Static", L"Button V6 with imagelist and no themes", 0, 4, -1);
178 CreateButtonSet(hWnd, &hwnd[75], 5, 5, BS_GROUPBOX);
179 CreateButtonSet(hWnd, &hwnd[80], 4, 10, BS_CHECKBOX);
181
182 for (int i = 30; i < 90; i++)
183 SetWindowTheme(hwnd[i], L"", L"");
184
185 for (int i = 60; i< 90; i++)
186 SendMessageW(hwnd[i], BCM_SETIMAGELIST, 0, (LPARAM)&btniml);
187
188 CreateWnd(hWnd, L"Static", L"Button V6 with themes and imagelist", 0, 6, -1);
189 CreateButtonSet(hWnd, &hwnd[120], 6, 0, BS_PUSHBUTTON);
192 CreateButtonSet(hWnd, &hwnd[135], 7, 5, BS_GROUPBOX);
193 CreateButtonSet(hWnd, &hwnd[140], 6, 10, BS_CHECKBOX);
194 CreateButtonSet(hWnd, &hwnd[145], 7, 10, BS_RADIOBUTTON);
195
196 CreateWnd(hWnd, L"Static", L"Button V6 with themes", 0, 8, -1);
200 CreateButtonSet(hWnd, &hwnd[105], 9, 5, BS_GROUPBOX);
201 CreateButtonSet(hWnd, &hwnd[110], 8, 10, BS_CHECKBOX);
202 CreateButtonSet(hWnd, &hwnd[115], 9, 10, BS_RADIOBUTTON);
203
204 for (int i = 120; i< 150; i++)
205 SendMessageW(hwnd[i], BCM_SETIMAGELIST, 0, (LPARAM)&btniml);
206
207 if (bActivated) DeactivateActCtx(0, cookie);
208
209 SCROLLINFO vsi = {sizeof(SCROLLINFO), SIF_ALL, 0, 2 * TOP_MARGIN + 10 * (Y_GAP + Y_HEIGHT), Y_HEIGHT, 0, 0};
210 SCROLLINFO hsi = {sizeof(SCROLLINFO), SIF_ALL, 0, 2 * LEFT_MARGIN + 13 * (X_GAP + X_WIDTH), X_WIDTH, 0, 0};
211
214
217
218 ShowWindow(hWnd, nCmdShow);
220
221 MSG msg;
222 while (GetMessage(&msg, NULL, 0, 0))
223 {
226 }
227
228 return (int) msg.wParam;
229}
#define msg(x)
Definition: auth_time.c:54
#define IDB_BITMAP1
Definition: resource.h:16
static void RegisterMyClass(HINSTANCE hInst)
static void CreateButtonSet(HWND hwndParent, HWND *ahwnd, int i, int j, DWORD style)
HIMAGELIST himl
HINSTANCE hInstance
Definition: charmap.c:19
#define FALSE
Definition: types.h:117
HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
Definition: imagelist.c:2208
#define LoadLibraryW(x)
Definition: compat.h:747
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:102
unsigned int BOOL
Definition: ntddk_ex.h:94
#define actctx
Definition: kernel32.h:8
#define IDB_BITMAP2
Definition: resource.h:6
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VSCROLL
Definition: pedump.c:627
#define BS_GROUPBOX
Definition: pedump.c:658
#define BS_CHECKBOX
Definition: pedump.c:653
#define WS_DISABLED
Definition: pedump.c:621
#define WS_HSCROLL
Definition: pedump.c:628
#define BS_RADIOBUTTON
Definition: pedump.c:655
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define BUTTON_IMAGELIST_ALIGN_LEFT
Definition: commctrl.h:4627
#define BCM_SETIMAGELIST
Definition: commctrl.h:4642
#define CLR_DEFAULT
Definition: commctrl.h:320
Definition: cookie.c:34
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t ULONG_PTR
Definition: typedefs.h:65
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define NULL_BRUSH
Definition: wingdi.h:901
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct tagSCROLLINFO SCROLLINFO
#define LR_CREATEDIBSECTION
Definition: winuser.h:1098
#define GetMessage
Definition: winuser.h:5799
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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 UpdateWindow(_In_ HWND)
#define SIF_ALL
Definition: winuser.h:1232
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
#define DispatchMessage
Definition: winuser.h:5774
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2194
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2106

Variable Documentation

◆ bSkipErase

BOOL bSkipErase

Definition at line 26 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ bSkipPaint

BOOL bSkipPaint

Definition at line 27 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbmp

HBITMAP hbmp

Definition at line 10 of file buttonvistest.cpp.

Referenced by Icon::add_to_imagelist(), QuickLaunchBar::AddButton(), CCicLibMenu::AddMenuItem(), QuickLaunchBar::AddShortcuts(), cicDrawMaskBmpOnDC(), Icon::create_bitmap(), create_bitmap(), create_bitmap_from_icon(), create_gdi_logbrush(), create_hatch_bitmap(), create_small_bitmap_from_icon(), CreateButtonSet(), CreatePatternBrush(), DECLARE_INTERFACE_(), DrawCheckedRect(), DwmSetIconicLivePreviewBitmap(), DwmSetIconicThumbnail(), DxEngSelectBitmap(), DxEngSetBitmapOwner(), EngCreateBitmap(), EngCreateDeviceBitmap(), TaskBar::EnumWndProc(), GdiSelectBitmap(), get_brush_bitmap_info(), get_graphics_device_bounds(), get_stgmed_for_bitmap(), GetBitmapPixelBuffer(), GetDiaogTextureBrush(), GetDIBits(), GetRealColorDepth(), GreCreateBitmapEx(), GreSetBitmapOwner(), HEXEDIT_WM_PAINT(), ImageList_AddAlphaIcon(), CCicLibMenuItem::Init(), insert_static_object(), ITextHostImpl_TxCreateCaret(), LangBarInsertMenu(), LISTVIEW_CreateDragImage(), LISTVIEW_Refresh(), ME_RTFReadPictGroup(), msi_seltree_create_imagelist(), NtGdiCreateBitmap(), NtGdiSelectBitmap(), PROPSHEET_Paint(), TaskBar::Refresh(), SetBitmap(), SpiSetWallpaper(), START_TEST(), sw_SetContext(), test_AppendMenu(), test_approximate_viewrect(), test_bcm_get_ideal_size(), Test_Bitmap(), test_bitmap(), Test_BitmapAttributes(), test_bm_get_set_image(), test_bmBits(), Test_BrushOrigin(), test_button_bm_get_set_image(), Test_CreateBitmap(), Test_CreateBitmap_Params(), test_CreateBitmapFromHBITMAP(), Test_CreateDIBitmap1(), Test_CreateDIBitmap_CBM_CREATDIB(), Test_CreateDIBitmap_DIB_PAL_COLORS(), Test_CreateDIBitmap_Params(), Test_CreateDIBitmap_RLE8(), Test_CreateDIBPatternBrushPt_RLE8(), test_DC_bitmap(), test_dib_formats(), test_DIB_PAL_COLORS(), test_FillRect(), test_get16dibits(), test_get_set_imagelist(), test_GetCurrentObject(), Test_GetDIBColorTable(), Test_GetDIBits(), test_GetDIBits(), Test_GetDIBits_xBpp(), Test_GetIdealSizeNoThemes(), Test_GetPixel_1bpp(), Test_GetRandomRgn_RGN5(), Test_GetRandomRgn_SYSRGN(), test_hittest(), test_images(), test_mbs_help(), test_memory_dc_clipping(), test_mono_1x1_bmp_dbg(), test_mono_bitmap(), Test_NtGdiDoPalette_SetDIBColorTable(), Test_SelectDIBSection(), Test_SetDCPenColor(), Test_SetDIBits(), Test_SetDIBits_1bpp(), Test_SetPixel_PAL(), Test_SrcMono(), ThemeEndBufferedPaint(), ThemeStartBufferedPaint(), TREEVIEW_CreateDragImage(), UserLoadImage(), UXTHEME_DrawThemePartToDib(), UXTHEME_GetImageBackBackgroundRegion(), WDML_DataHandle2Global(), WDML_Global2DataHandle(), WinGGetDIBPointer(), WinMain(), and wWinMain().

◆ hbrBlue

HBRUSH hbrBlue

Definition at line 17 of file buttonvistest.cpp.

Referenced by MainWndProc(), WndProc(), and wWinMain().

◆ hbrCtlColorBtn

HBRUSH hbrCtlColorBtn

Definition at line 22 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbrCtlColorStatic

HBRUSH hbrCtlColorStatic

Definition at line 21 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbrCyan

HBRUSH hbrCyan

Definition at line 18 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbrErase

HBRUSH hbrErase

Definition at line 24 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbrGreen

HBRUSH hbrGreen

Definition at line 16 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbrNULL

HBRUSH hbrNULL

Definition at line 14 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbrPrintClientClear

HBRUSH hbrPrintClientClear

Definition at line 23 of file buttonvistest.cpp.

Referenced by WndProc(), and wWinMain().

◆ hbrRed

HBRUSH hbrRed

Definition at line 15 of file buttonvistest.cpp.

Referenced by MainWndProc(), WndProc(), and wWinMain().

◆ hbrYellow

HBRUSH hbrYellow

Definition at line 19 of file buttonvistest.cpp.

Referenced by MainWndProc(), WndProc(), and wWinMain().

◆ hico

◆ himl

HIMAGELIST himl

Definition at line 11 of file buttonvistest.cpp.

Referenced by add_dib_bits(), Icon::add_to_imagelist(), add_with_alpha(), AddListViewItems(), AddWallpapersFromDirectory(), alpha_blend_image(), check_bits(), check_color_table(), check_ImageList_DrawIndirect_broken(), check_ImageList_DrawIndirect_fState(), check_ImageList_DrawIndirect_fStyle(), check_ImageList_DrawIndirect_ILD_ROP(), check_iml_data(), Icon::create_bitmap(), createImageList(), CShellLink::CreateShortcutIcon(), DestroyTreeView(), CUIFTheme::DrawThemeIcon(), FILEDLG95_InitControls(), FileOpenDlgProc95(), HEADER_CreateDragImage(), HEADER_SetImageList(), HIMAGELIST_QueryInterface(), image_list_add_bitmap(), image_list_init(), ImageList_Add(), ImageList_AddAlphaIcon(), ImageList_AddIcon(), ImageList_AddMasked(), imagelist_copy_images(), ImageList_Create(), ImageList_CreateImage(), ImageList_Destroy(), ImageList_Draw(), ImageList_DrawEx(), ImageList_DrawIndirect(), imagelist_get_bitmap_size(), ImageList_GetBkColor(), ImageList_GetFlags(), ImageList_GetIcon(), ImageList_GetIconSize(), ImageList_GetImageCount(), ImageList_GetImageInfo(), ImageList_GetImageRect(), IMAGELIST_InternalExpandBitmaps(), ImageList_LoadImageA(), ImageList_LoadImageW(), imagelist_point_from_index(), ImageList_Read(), ImageList_Remove(), ImageList_Replace(), ImageList_ReplaceIcon(), ImageList_SetBkColor(), ImageList_SetColorTable(), ImageList_SetFilter(), ImageList_SetFlags(), ImageList_SetIconSize(), ImageList_SetImageCount(), ImageList_SetOverlayImage(), ImageList_Write(), InitImageList(), InitListViewImageLists(), CFontsDialog::InitToolbar(), InitTreeViewImageLists(), is_valid(), LISTVIEW_CreateCheckBoxIL(), LISTVIEW_DrawItemPart(), LISTVIEW_SetColumnWidth(), LISTVIEW_SetExtendedListViewStyle(), LISTVIEW_SetImageList(), LISTVIEW_SetView(), LISTVIEW_StyleChanged(), MD_ListView_OnSetImageList(), MD_TreeView_OnSetImageList(), msi_seltree_create_imagelist(), OnBrowseButton(), set_icon_size(), CToolbar< TItemData >::SetImageList(), CListView::SetImageList(), CTreeView::SetImageList(), show_image(), test_add_bitmap(), test_add_remove(), test_approximate_viewrect(), test_bcm_get_ideal_size(), test_begindrag(), test_color_table(), test_create_destroy(), test_createdragimage(), test_DrawIndirect(), test_get_set_imagelist(), Test_GetIdealSizeNoThemes(), test_getitemrect(), test_hittest(), test_iconsize(), test_iimagelist(), test_IImageList_Add_Remove(), test_IImageList_Clone(), test_IImageList_Draw(), test_IImageList_Get_SetImageCount(), test_IImageList_GetBkColor(), test_IImageList_GetIconSize(), test_IImageList_GetImageCount(), test_IImageList_SetBkColor(), test_imagecount(), test_ImageList_DrawIndirect(), test_imagelist_storage(), test_images(), test_layout(), test_merge_colors(), test_removeimage(), test_sizes(), test_tab(), test_TVS_CHECKBOXES(), ThemePageDlgProc(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DrawImage(), TOOLBAR_DrawMasked(), TOOLBAR_GetImageListForDrawing(), TOOLBAR_InsertImageList(), TOOLBAR_IsValidBitmapIndex(), TOOLBAR_IsValidImageList(), TOOLBAR_SetDisabledImageList(), TOOLBAR_SetHotImageList(), TOOLBAR_SetImageList(), and wWinMain().

◆ scPos

POINT scPos

Definition at line 12 of file buttonvistest.cpp.

Referenced by OnScroll(), and wWinMain().