ReactOS 0.4.16-dev-329-g9223134
multiwin.c File Reference
#include <windows.h>
#include <stdio.h>
Include dependency graph for multiwin.c:

Go to the source code of this file.

Functions

LRESULT WINAPI MultiWndProc (HWND, UINT, WPARAM, LPARAM)
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
 

Variables

static UINT WindowCount
 

Function Documentation

◆ MultiWndProc()

LRESULT WINAPI MultiWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 91 of file multiwin.c.

92{
93 PAINTSTRUCT ps;
94 HDC hDC;
95 LONG Style;
97 HBRUSH Brush;
98 static COLORREF Colors[] =
99 {
100 RGB(0x00, 0x00, 0x00),
101 RGB(0x80, 0x00, 0x00),
102 RGB(0x00, 0x80, 0x00),
103 RGB(0x00, 0x00, 0x80),
104 RGB(0x80, 0x80, 0x00),
105 RGB(0x80, 0x00, 0x80),
106 RGB(0x00, 0x80, 0x80),
107 RGB(0x80, 0x80, 0x80),
108 RGB(0xff, 0x00, 0x00),
109 RGB(0x00, 0xff, 0x00),
110 RGB(0x00, 0x00, 0xff),
111 RGB(0xff, 0xff, 0x00),
112 RGB(0xff, 0x00, 0xff),
113 RGB(0x00, 0xff, 0xff),
114 RGB(0xff, 0xff, 0xff)
115 };
116 static unsigned CurrentColor = 0;
117
118 switch(msg)
119 {
120 case WM_PAINT:
121 hDC = BeginPaint(hWnd, &ps);
126 CurrentColor++;
127 if (sizeof(Colors) / sizeof(Colors[0]) <= CurrentColor)
128 {
129 CurrentColor = 0;
130 }
131 EndPaint(hWnd, &ps);
132 break;
133
134 case WM_DESTROY:
136 if (0 == (Style & WS_CHILD) && 0 == --WindowCount)
137 {
139 }
140 break;
141
142 default:
144 }
145
146 return 0;
147}
static HDC hDC
Definition: 3dtext.c:33
static UINT CurrentColor
Colors
Definition: ansiprsr.h:4
const DWORD Style
Definition: appswitch.c:71
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define RGB(r, g, b)
Definition: precomp.h:71
pKey DeleteObject()
static HDC
Definition: imagelist.c:88
static UINT WindowCount
Definition: multiwin.c:4
#define WS_CHILD
Definition: pedump.c:617
long LONG
Definition: pedump.c:60
#define DefWindowProc
Definition: ros2win.h:31
Definition: client.c:28
DWORD COLORREF
Definition: windef.h:300
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define WM_PAINT
Definition: winuser.h:1623
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define GetWindowLong
Definition: winuser.h:5808
#define WM_DESTROY
Definition: winuser.h:1612
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWL_STYLE
Definition: winuser.h:855

Referenced by WinMain().

◆ WinMain()

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 8 of file multiwin.c.

12{
13 WNDCLASS wc;
14 MSG msg;
15 HWND hWnd1;
16 HWND hWnd2;
18
19 wc.lpszClassName = "MultiClass";
25 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
26 wc.lpszMenuName = NULL;
27 wc.cbClsExtra = 0;
28 wc.cbWndExtra = 0;
29 if (RegisterClass(&wc) == 0)
30 {
31 fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n",
32 GetLastError());
33 return(1);
34 }
35
36 hWnd1 = CreateWindow("MultiClass",
37 "TopLevel1",
39 0,
40 0,
41 320,
42 240,
43 NULL,
44 NULL,
46 NULL);
47
48 hWndChild = CreateWindow("MultiClass",
49 "Child1 of TopLevel1",
51 20,
52 120,
53 200,
54 200,
55 hWnd1,
56 NULL,
58 NULL);
59
60 hWnd2 = CreateWindow("MultiClass",
61 "TopLevel2",
63 400,
64 0,
65 160,
66 490,
67 NULL,
68 NULL,
70 NULL);
71
72 if (! hWnd1 || ! hWnd2 || ! hWndChild)
73 {
74 fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n",
75 GetLastError());
76 return(1);
77 }
78 WindowCount = 2;
79
82
83 while(GetMessage(&msg, NULL, 0, 0))
84 {
87 }
88 return msg.wParam;
89}
HINSTANCE hInstance
Definition: charmap.c:19
#define NULL
Definition: types.h:112
HWND hWndChild[NUM_TABS]
Definition: main.h:74
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
HWND hWnd1
Definition: button.c:416
HWND hWnd2
Definition: button.c:416
LRESULT WINAPI MultiWndProc(HWND, UINT, WPARAM, LPARAM)
Definition: multiwin.c:91
#define WS_CAPTION
Definition: pedump.c:624
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_BORDER
Definition: pedump.c:625
#define WS_VISIBLE
Definition: pedump.c:620
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CS_VREDRAW
Definition: winuser.h:658
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define IDI_APPLICATION
Definition: winuser.h:704
#define CreateWindow
Definition: winuser.h:5766
#define GetMessage
Definition: winuser.h:5802
#define LoadIcon
Definition: winuser.h:5825
#define LoadCursor
Definition: winuser.h:5824
#define RegisterClass
Definition: winuser.h:5848
#define DispatchMessage
Definition: winuser.h:5777
#define SW_NORMAL
Definition: winuser.h:772
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

Variable Documentation

◆ WindowCount

UINT WindowCount
static

Definition at line 4 of file multiwin.c.

Referenced by GuiConsoleInputThread(), MultiWndProc(), and WinMain().