ReactOS 0.4.15-dev-8102-g108db8f
buttontst.c
Go to the documentation of this file.
1/* Based on Radoslaw Sokol's static control test. */
2#include <windows.h>
3
4static LPSTR BUTTON_CLASS = "BUTTON";
5static LPSTR TEST_WND_CLASS = "TESTWND";
6
7#ifdef NDEBUG
8 #define DPRINT(s) (void)0
9#else
10 #define DPRINT(s) OutputDebugStringA("BUTTONTEST: " s "\n")
11#endif
12
14
16 HWND Wnd)
17{
18 DPRINT("WM_CREATE (enter).");
19 DPRINT("test 1");
21 10, 10, 150, 30, Wnd, NULL, AppInstance, NULL);
22 DPRINT("test 2");
24 10, 40, 150, 30, Wnd, NULL, AppInstance, NULL);
25 DPRINT("test 3");
27 10, 70, 150, 30, Wnd, NULL, AppInstance, NULL);
28 DPRINT("test 4");
30 10, 100, 150, 30, Wnd, NULL, AppInstance, NULL);
31
32 DPRINT("WM_CREATE (leave).");
33 return 0;
34}
35
37 HWND Wnd,
38 UINT Msg,
41{
42 switch (Msg) {
43 case WM_CREATE:
44 return WmCreate(Wnd);
45 case WM_DESTROY:
47 return 0;
48 default:
49 return DefWindowProc(Wnd, Msg, wParam, lParam);
50 }
51}
52
55 HINSTANCE hPrevInstance,
56 LPSTR lpCmdLine,
57 int nShowCmd)
58{
60 MSG Msg;
61 HWND MainWindow;
62 WNDCLASSEX TestWndClass = {0};
63 DPRINT("Application starting up.");
64 // Remember instance handle.
66 // Register test window class.
67 TestWndClass.cbSize = sizeof(WNDCLASSEX);
68 TestWndClass.lpfnWndProc = &TestWndProc;
69 TestWndClass.hInstance = AppInstance;
70 TestWndClass.hCursor = LoadCursor(0, (LPCTSTR)IDC_ARROW);
71 TestWndClass.hbrBackground = CreateSolidBrush(RGB(255,255,230));
72 TestWndClass.lpszClassName = TEST_WND_CLASS;
73 Result = RegisterClassEx(&TestWndClass);
74 if (Result == 0) {
75 DPRINT("Error registering class.");
76 MessageBox(0, "Error registering test window class.",
77 "Button control test", MB_ICONSTOP | MB_OK);
78 ExitProcess(0);
79 }
80 // Create main window.
81 DPRINT("Creating main window.");
83 TEST_WND_CLASS, "Button test",
84 WS_OVERLAPPEDWINDOW, 50, 50, 180, 365,
86 if (MainWindow == 0) {
87 DPRINT("Error creating main window.");
89 MessageBox(0, "Error creating test window.",
90 "Static control test", MB_ICONSTOP | MB_OK);
91 ExitProcess(0);
92 }
93 DPRINT("Showing main window.");
94 ShowWindow(MainWindow, SW_SHOWNORMAL);
95 UpdateWindow(MainWindow);
96 // Run message loop.
97 DPRINT("Entering message loop.");
98 while (GetMessage(&Msg, NULL, 0, 0) > 0) {
101 }
102 // Unregister window class.
104 DPRINT("Exiting.");
105
106 return Msg.wParam;
107}
HINSTANCE AppInstance
Definition: buttontst.c:13
LRESULT WmCreate(HWND Wnd)
Definition: buttontst.c:15
static LPSTR BUTTON_CLASS
Definition: buttontst.c:4
static LPSTR TEST_WND_CLASS
Definition: buttontst.c:5
LRESULT CALLBACK TestWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: buttontst.c:36
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
Definition: buttontst.c:53
#define DPRINT(s)
Definition: buttontst.c:10
HINSTANCE hInstance
Definition: charmap.c:19
struct @1636 Msg[]
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 CALLBACK
Definition: compat.h:35
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
#define RGB(r, g, b)
Definition: precomp.h:71
unsigned int UINT
Definition: ndis.h:50
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define DefWindowProc
Definition: ros2win.h:31
HINSTANCE hInstance
Definition: winuser.h:3206
HCURSOR hCursor
Definition: winuser.h:3208
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HBRUSH hbrBackground
Definition: winuser.h:3209
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define GetModuleHandle
Definition: winbase.h:3827
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define CreateWindowEx
Definition: winuser.h:5755
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WM_CREATE
Definition: winuser.h:1608
#define WS_EX_APPWINDOW
Definition: winuser.h:383
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define IDC_ARROW
Definition: winuser.h:687
#define UnregisterClass
Definition: winuser.h:5861
#define GetMessage
Definition: winuser.h:5790
#define RegisterClassEx
Definition: winuser.h:5837
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LoadCursor
Definition: winuser.h:5812
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5719
#define MB_OK
Definition: winuser.h:790
#define MessageBox
Definition: winuser.h:5822
#define MB_ICONSTOP
Definition: winuser.h:803
#define WM_DESTROY
Definition: winuser.h:1609
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define DispatchMessage
Definition: winuser.h:5765
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
char * LPSTR
Definition: xmlstorage.h:182
const CHAR * LPCTSTR
Definition: xmlstorage.h:193