ReactOS 0.4.15-dev-8058-ga7cbb60
statst2.c
Go to the documentation of this file.
1// Static Control Test.c
2
3//#define WIN32_LEAN_AND_MEAN
4#include <windows.h>
5#include <assert.h>
6
7#ifndef SS_ENDELLIPSIS
8#define SS_ENDELLIPSIS 0x00004000L
9#endif /* SS_ENDELLIPSIS */
10
11
12#define nMaxCtrls 32
13#define nStaticWidth 384
14#define nStaticHeight 18
15
18int nNextCtrl = 0;
20
21static void CreateStatic ( const char* lpWindowName, DWORD dwStyle )
22{
23 int n = nNextCtrl++;
24 assert ( n < nMaxCtrls );
26 "STATIC", // lpClassName
27 lpWindowName, // lpWindowName
28 WS_VISIBLE|WS_CHILD|dwStyle, // dwStyle
29 n+2, // x
30 nStaticHeight*n+1, // y
31 nStaticWidth, // nWidth
32 nStaticHeight-1, // nHeight
33 g_hwnd, // hWndParent
34 NULL, // hMenu
35 g_hInst, // hInstance
36 NULL ); // lParam
37}
38
40{
41 int i;
42 switch ( msg )
43 {
44 case WM_CREATE:
45 g_hwnd = hwnd;
46 for ( i = 0; i < nMaxCtrls; i++ )
47 g_hwndCtrl[i] = NULL;
48
49 CreateStatic ( "SS_NOTIFY test (click/double-click here)", SS_NOTIFY );
50
51 CreateStatic ( "SS_ENDELLIPSIS test test test test test test test test test test test", SS_ENDELLIPSIS );
52
53 CreateStatic ( "SS_CENTER test", SS_CENTER );
54
55 CreateStatic ( "SS_RIGHT test", SS_RIGHT );
56
57 CreateStatic ( "SS_BLACKFRAME test:", 0 );
58 CreateStatic ( "this text shouldn't be visible!", SS_BLACKFRAME );
59
60 CreateStatic ( "SS_BLACKRECT test:", 0 );
61 CreateStatic ( "this text shouldn't be visible!", SS_BLACKRECT );
62
63 CreateStatic ( "SS_ETCHEDFRAME test:", 0 );
64 CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDFRAME );
65
66 CreateStatic ( "SS_ETCHEDHORZ test:", 0 );
67 CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDHORZ );
68
69 CreateStatic ( "SS_ETCHEDVERT test", 0 );
70 CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDVERT );
71
72 CreateStatic ( "SS_GRAYFRAME test", 0 );
73 CreateStatic ( "this text shouldn't be visible!", SS_GRAYFRAME );
74
75 CreateStatic ( "SS_GRAYRECT test", 0 );
76 CreateStatic ( "this text shouldn't be visible!", SS_GRAYRECT );
77
78 CreateStatic ( "SS_NOPREFIX &test", SS_NOPREFIX );
79
80 CreateStatic ( "SS_OWNERDRAW test", SS_OWNERDRAW );
81
82 CreateStatic ( "SS_SUNKEN test", SS_SUNKEN );
83
84 CreateStatic ( "SS_WHITEFRAME test:", 0 );
85 CreateStatic ( "this text shouldn't be visible!", SS_WHITEFRAME );
86
87 CreateStatic ( "SS_WHITERECT test:", 0 );
88 CreateStatic ( "this text shouldn't be visible!", SS_WHITERECT );
89
90 //if ( creation fails )
91 // return 0;
92 break;
93
94 case WM_COMMAND:
95 if ( HIWORD(wParam) == STN_CLICKED )
96 SetWindowText ( (HWND)lParam, "SS_NOTIFY:STN_CLICKED!" );
97 if ( HIWORD(wParam) == STN_DBLCLK )
98 SetWindowText ( (HWND)lParam, "SS_NOTIFY:STN_DBLCLK!" );
99 break;
100
101 case WM_DRAWITEM:
102 {
104 DrawText ( lpDrawItem->hDC, "SS_DRAWITEM test successful!", 28, &(lpDrawItem->rcItem), 0 );
105 }
106 break;
107
108 case WM_DESTROY:
110 return 0;
111 }
112 return DefWindowProc ( hwnd, msg, wParam, lParam );
113}
114
117 const char* className,
118 const char* title )
119{
120 WNDCLASSEX wc;
121 HWND hwnd;
122
123 g_hInst = hInst;
124
125 wc.cbSize = sizeof (WNDCLASSEX);
126 wc.lpfnWndProc = WndProc; // window procedure: mandatory
127 wc.hInstance = hInst; // owner of the class: mandatory
128 wc.lpszClassName = className; // mandatory
129 wc.hCursor = LoadCursor ( 0, (LPCTSTR)IDC_ARROW ); // optional
130 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // optional
131 wc.style = 0;
132 wc.cbClsExtra = 0;
133 wc.cbWndExtra = 0;
134 wc.hIcon = 0;
135 wc.hIconSm = 0;
136 wc.lpszMenuName = 0;
137 if ( !RegisterClassEx ( &wc ) )
138 return NULL;
139
141 0, // dwStyleEx
142 className, // class name
143 title, // window title
144 WS_OVERLAPPEDWINDOW, // dwStyle
145 CW_USEDEFAULT, // x
146 CW_USEDEFAULT, // y
147 CW_USEDEFAULT, // width
148 CW_USEDEFAULT, // height
149 NULL, // hwndParent
150 NULL, // hMenu
151 hInst, // hInstance
152 0 ); // lParam
153
154 if ( !hwnd )
155 return NULL;
156
158 UpdateWindow ( hwnd );
159
160 return hwnd;
161}
162
163int WINAPI WinMain ( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow )
164{
165 char className [] = "Static Control Test";
166 HWND hwnd;
167 MSG msg;
168 int status;
169
170 hwnd = RegisterAndCreateWindow ( hInst, className, "Static Control Test" );
171
172 // Message loop
173 while ((status = GetMessage (& msg, 0, 0, 0)) != 0)
174 {
175 if (status == -1)
176 return -1;
177 DispatchMessage ( &msg );
178 }
179 return msg.wParam;
180}
#define msg(x)
Definition: auth_time.c:54
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define CALLBACK
Definition: compat.h:35
#define assert(x)
Definition: debug.h:53
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble n
Definition: glext.h:7729
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
unsigned int UINT
Definition: ndis.h:50
#define SS_WHITERECT
Definition: pedump.c:698
#define SS_WHITEFRAME
Definition: pedump.c:701
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define SS_BLACKRECT
Definition: pedump.c:696
#define SS_RIGHT
Definition: pedump.c:694
#define WS_VISIBLE
Definition: pedump.c:620
#define SS_GRAYFRAME
Definition: pedump.c:700
#define SS_CENTER
Definition: pedump.c:693
#define SS_GRAYRECT
Definition: pedump.c:697
#define SS_BLACKFRAME
Definition: pedump.c:699
static char title[]
Definition: ps.c:92
#define DefWindowProc
Definition: ros2win.h:31
#define nMaxCtrls
Definition: statst2.c:12
#define nStaticHeight
Definition: statst2.c:14
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: statst2.c:39
HWND g_hwnd
Definition: statst2.c:16
#define nStaticWidth
Definition: statst2.c:13
static void CreateStatic(const char *lpWindowName, DWORD dwStyle)
Definition: statst2.c:21
int nNextCtrl
Definition: statst2.c:18
HWND RegisterAndCreateWindow(HINSTANCE hInst, const char *className, const char *title)
Definition: statst2.c:115
#define SS_ENDELLIPSIS
Definition: statst2.c:8
HINSTANCE g_hInst
Definition: statst2.c:17
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow)
Definition: statst2.c:163
HWND g_hwndCtrl[nMaxCtrls]
Definition: statst2.c:19
int cbClsExtra
Definition: winuser.h:3204
HINSTANCE hInstance
Definition: winuser.h:3206
HCURSOR hCursor
Definition: winuser.h:3208
LPCSTR lpszMenuName
Definition: winuser.h:3210
HICON hIconSm
Definition: winuser.h:3212
UINT style
Definition: winuser.h:3202
int cbWndExtra
Definition: winuser.h:3205
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HICON hIcon
Definition: winuser.h:3207
HBRUSH hbrBackground
Definition: winuser.h:3209
Definition: ps.c:97
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define HIWORD(l)
Definition: typedefs.h:247
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
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
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define CreateWindowEx
Definition: winuser.h:5755
#define COLOR_WINDOW
Definition: winuser.h:918
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WM_CREATE
Definition: winuser.h:1608
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define SS_OWNERDRAW
Definition: winuser.h:352
#define WM_COMMAND
Definition: winuser.h:1740
#define SS_NOTIFY
Definition: winuser.h:351
#define IDC_ARROW
Definition: winuser.h:687
#define SS_ETCHEDFRAME
Definition: winuser.h:342
#define SS_NOPREFIX
Definition: winuser.h:350
#define SS_ETCHEDHORZ
Definition: winuser.h:343
#define SS_ETCHEDVERT
Definition: winuser.h:344
#define WM_DRAWITEM
Definition: winuser.h:1645
#define DrawText
Definition: winuser.h:5771
#define CreateWindow
Definition: winuser.h:5754
#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 CW_USEDEFAULT
Definition: winuser.h:225
#define SW_SHOW
Definition: winuser.h:775
#define WM_DESTROY
Definition: winuser.h:1609
#define SetWindowText
Definition: winuser.h:5857
#define DispatchMessage
Definition: winuser.h:5765
#define STN_DBLCLK
Definition: winuser.h:2095
#define SS_SUNKEN
Definition: winuser.h:358
#define STN_CLICKED
Definition: winuser.h:2094
char * LPSTR
Definition: xmlstorage.h:182
const CHAR * LPCTSTR
Definition: xmlstorage.h:193