[TCPIP]
[reactos.git] / base / applications / mspaint / main.c
1 /*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL
4 * FILE: base/applications/paint/main.c
5 * PURPOSE: Initializing everything
6 * PROGRAMMERS: Benedikt Freisen
7 */
8
9 /* INCLUDES *********************************************************/
10
11 #include "precomp.h"
12
13 /* FUNCTIONS ********************************************************/
14
15 HDC hDrawingDC;
16 HDC hSelDC;
17 int *bmAddress;
18 BITMAPINFO bitmapinfo;
19 int imgXRes = 400;
20 int imgYRes = 300;
21
22 HBITMAP hBms[HISTORYSIZE];
23 int currInd = 0;
24 int undoSteps = 0;
25 int redoSteps = 0;
26 BOOL imageSaved = TRUE;
27
28 LONG startX;
29 LONG startY;
30 LONG lastX;
31 LONG lastY;
32 int lineWidth = 1;
33 int shapeStyle = 0;
34 int brushStyle = 0;
35 int activeTool = TOOL_PEN;
36 int airBrushWidth = 5;
37 int rubberRadius = 4;
38 int transpBg = 0;
39 int zoom = 1000;
40 int rectSel_src[4];
41 int rectSel_dest[4];
42 HWND hSelection;
43 HWND hImageArea;
44 HBITMAP hSelBm;
45 HBITMAP hSelMask;
46
47 /* initial palette colors; may be changed by the user during execution */
48 int palColors[28] = { 0x000000, 0x464646, 0x787878, 0x300099, 0x241ced, 0x0078ff, 0x0ec2ff,
49 0x00f2ff, 0x1de6a8, 0x4cb122, 0xefb700, 0xf36d4d, 0x99362f, 0x98316f,
50 0xffffff, 0xdcdcdc, 0xb4b4b4, 0x3c5a9c, 0xb1a3ff, 0x7aaae5, 0x9ce4f5,
51 0xbdf9ff, 0xbcf9d3, 0x61bb9d, 0xead999, 0xd19a70, 0x8e6d54, 0xd5a5b5
52 };
53
54 /* foreground and background colors with initial value */
55 int fgColor = 0x00000000;
56 int bgColor = 0x00ffffff;
57
58 HWND hStatusBar;
59 HWND hScrollbox;
60 HWND hMainWnd;
61 HWND hPalWin;
62 HWND hToolBoxContainer;
63 HWND hToolSettings;
64 HWND hTrackbarZoom;
65 CHOOSECOLOR choosecolor;
66 OPENFILENAME ofn;
67 OPENFILENAME sfn;
68 HICON hNontranspIcon;
69 HICON hTranspIcon;
70
71 HCURSOR hCurFill;
72 HCURSOR hCurColor;
73 HCURSOR hCurZoom;
74 HCURSOR hCurPen;
75 HCURSOR hCurAirbrush;
76
77 HWND hScrlClient;
78
79 HWND hToolBtn[16];
80
81 HINSTANCE hProgInstance;
82
83 TCHAR filename[256];
84 TCHAR filepathname[1000];
85 BOOL isAFile = FALSE;
86 int fileSize;
87 int fileHPPM = 2834;
88 int fileVPPM = 2834;
89 SYSTEMTIME fileTime;
90
91 BOOL showGrid = FALSE;
92 BOOL showMiniature = FALSE;
93
94 HWND hwndMiniature;
95
96 HWND hSizeboxLeftTop;
97 HWND hSizeboxCenterTop;
98 HWND hSizeboxRightTop;
99 HWND hSizeboxLeftCenter;
100 HWND hSizeboxRightCenter;
101 HWND hSizeboxLeftBottom;
102 HWND hSizeboxCenterBottom;
103 HWND hSizeboxRightBottom;
104
105 /* entry point */
106
107 int WINAPI
108 _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nFunsterStil)
109 {
110 HWND hwnd; /* This is the handle for our window */
111 MSG messages; /* Here messages to the application are saved */
112
113 WNDCLASSEX wclScroll;
114 WNDCLASSEX wincl;
115 WNDCLASSEX wclPal;
116 WNDCLASSEX wclSettings;
117 WNDCLASSEX wclSelection;
118
119 TCHAR progtitle[1000];
120 TCHAR resstr[100];
121 HMENU menu;
122 HWND hToolbar;
123 HIMAGELIST hImageList;
124 HANDLE haccel;
125 HBITMAP tempBm;
126 int i;
127 TCHAR tooltips[16][30];
128 HDC hDC;
129
130 TCHAR *c;
131 TCHAR sfnFilename[1000];
132 TCHAR sfnFiletitle[256];
133 TCHAR sfnFilter[1000];
134 TCHAR ofnFilename[1000];
135 TCHAR ofnFiletitle[256];
136 TCHAR ofnFilter[1000];
137 TCHAR miniaturetitle[100];
138 static int custColors[16] = { 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
139 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff
140 };
141
142 hProgInstance = hThisInstance;
143
144 /* Necessary */
145 InitCommonControls();
146
147 /* initializing and registering the window class used for the main window */
148 wincl.hInstance = hThisInstance;
149 wincl.lpszClassName = _T("WindowsApp");
150 wincl.lpfnWndProc = WindowProcedure;
151 wincl.style = CS_DBLCLKS;
152 wincl.cbSize = sizeof(WNDCLASSEX);
153 wincl.hIcon = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_APPICON));
154 wincl.hIconSm = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_APPICON));
155 wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
156 wincl.lpszMenuName = NULL;
157 wincl.cbClsExtra = 0;
158 wincl.cbWndExtra = 0;
159 wincl.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
160 RegisterClassEx (&wincl);
161
162 /* initializing and registering the window class used for the scroll box */
163 wclScroll.hInstance = hThisInstance;
164 wclScroll.lpszClassName = _T("Scrollbox");
165 wclScroll.lpfnWndProc = WindowProcedure;
166 wclScroll.style = 0;
167 wclScroll.cbSize = sizeof(WNDCLASSEX);
168 wclScroll.hIcon = NULL;
169 wclScroll.hIconSm = NULL;
170 wclScroll.hCursor = LoadCursor(NULL, IDC_ARROW);
171 wclScroll.lpszMenuName = NULL;
172 wclScroll.cbClsExtra = 0;
173 wclScroll.cbWndExtra = 0;
174 wclScroll.hbrBackground = GetSysColorBrush(COLOR_APPWORKSPACE);
175 RegisterClassEx (&wclScroll);
176
177 /* initializing and registering the window class used for the palette window */
178 wclPal.hInstance = hThisInstance;
179 wclPal.lpszClassName = _T("Palette");
180 wclPal.lpfnWndProc = PalWinProc;
181 wclPal.style = CS_DBLCLKS;
182 wclPal.cbSize = sizeof(WNDCLASSEX);
183 wclPal.hIcon = NULL;
184 wclPal.hIconSm = NULL;
185 wclPal.hCursor = LoadCursor(NULL, IDC_ARROW);
186 wclPal.lpszMenuName = NULL;
187 wclPal.cbClsExtra = 0;
188 wclPal.cbWndExtra = 0;
189 wclPal.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
190 RegisterClassEx (&wclPal);
191
192 /* initializing and registering the window class for the settings window */
193 wclSettings.hInstance = hThisInstance;
194 wclSettings.lpszClassName = _T("ToolSettings");
195 wclSettings.lpfnWndProc = SettingsWinProc;
196 wclSettings.style = CS_DBLCLKS;
197 wclSettings.cbSize = sizeof(WNDCLASSEX);
198 wclSettings.hIcon = NULL;
199 wclSettings.hIconSm = NULL;
200 wclSettings.hCursor = LoadCursor(NULL, IDC_ARROW);
201 wclSettings.lpszMenuName = NULL;
202 wclSettings.cbClsExtra = 0;
203 wclSettings.cbWndExtra = 0;
204 wclSettings.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
205 RegisterClassEx (&wclSettings);
206
207 /* initializing and registering the window class for the selection frame */
208 wclSelection.hInstance = hThisInstance;
209 wclSelection.lpszClassName = _T("Selection");
210 wclSelection.lpfnWndProc = SelectionWinProc;
211 wclSelection.style = CS_DBLCLKS;
212 wclSelection.cbSize = sizeof(WNDCLASSEX);
213 wclSelection.hIcon = NULL;
214 wclSelection.hIconSm = NULL;
215 wclSelection.hCursor = LoadCursor(NULL, IDC_SIZEALL);
216 wclSelection.lpszMenuName = NULL;
217 wclSelection.cbClsExtra = 0;
218 wclSelection.cbWndExtra = 0;
219 wclSelection.hbrBackground = NULL;
220 RegisterClassEx (&wclSelection);
221
222 /* initializing and registering the window class for the size boxes */
223 wclSettings.hInstance = hThisInstance;
224 wclSettings.lpszClassName = _T("Sizebox");
225 wclSettings.lpfnWndProc = SizeboxWinProc;
226 wclSettings.style = CS_DBLCLKS;
227 wclSettings.cbSize = sizeof(WNDCLASSEX);
228 wclSettings.hIcon = NULL;
229 wclSettings.hIconSm = NULL;
230 wclSettings.hCursor = LoadCursor(NULL, IDC_ARROW);
231 wclSettings.lpszMenuName = NULL;
232 wclSettings.cbClsExtra = 0;
233 wclSettings.cbWndExtra = 0;
234 wclSettings.hbrBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
235 RegisterClassEx (&wclSettings);
236
237 LoadString(hThisInstance, IDS_DEFAULTFILENAME, filename, SIZEOF(filename));
238 LoadString(hThisInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
239 _stprintf(progtitle, resstr, filename);
240 LoadString(hThisInstance, IDS_MINIATURETITLE, miniaturetitle, SIZEOF(miniaturetitle));
241
242 /* create main window */
243 hwnd =
244 CreateWindowEx(0, _T("WindowsApp"), progtitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544,
245 375, HWND_DESKTOP, NULL, hThisInstance, NULL);
246 hMainWnd = hwnd;
247
248 hwndMiniature =
249 CreateWindowEx(WS_EX_PALETTEWINDOW, _T("WindowsApp"), miniaturetitle,
250 WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, 180, 200, 120, 100, hwnd,
251 NULL, hThisInstance, NULL);
252
253 /* loading and setting the window menu from resource */
254 menu = LoadMenu(hThisInstance, MAKEINTRESOURCE(ID_MENU));
255 SetMenu(hwnd, menu);
256 haccel = LoadAccelerators(hThisInstance, MAKEINTRESOURCE(800));
257
258 /* preloading the draw transparent/nontransparent icons for later use */
259 hNontranspIcon =
260 LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_NONTRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR);
261 hTranspIcon =
262 LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_TRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR);
263
264 hCurFill = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_FILL));
265 hCurColor = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_COLOR));
266 hCurZoom = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_ZOOM));
267 hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
268 hCurAirbrush = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
269
270 CreateWindowEx(0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL,
271 hThisInstance, NULL);
272
273 hToolBoxContainer =
274 CreateWindowEx(0, _T("WindowsApp"), _T(""), WS_CHILD | WS_VISIBLE, 2, 2, 52, 350, hwnd, NULL,
275 hThisInstance, NULL);
276 /* creating the 16 bitmap radio buttons and setting the bitmap */
277
278
279 /*
280 * FIXME: Unintentionally there is a line above the tool bar.
281 * To prevent cropping of the buttons height has been increased from 200 to 205
282 */
283 hToolbar =
284 CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
285 WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN | CCS_VERT | CCS_NORESIZE | TBSTYLE_TOOLTIPS,
286 1, 1, 50, 205, hToolBoxContainer, NULL, hThisInstance, NULL);
287 hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 16, 0);
288 SendMessage(hToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList);
289 tempBm = LoadImage(hThisInstance, MAKEINTRESOURCE(IDB_TOOLBARICONS), IMAGE_BITMAP, 256, 16, 0);
290 ImageList_AddMasked(hImageList, tempBm, 0xff00ff);
291 DeleteObject(tempBm);
292 SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
293
294 for(i = 0; i < 16; i++)
295 {
296 TBBUTTON tbbutton;
297 int wrapnow = 0;
298
299 if (i % 2 == 1)
300 wrapnow = TBSTATE_WRAP;
301
302 LoadString(hThisInstance, IDS_TOOLTIP1 + i, tooltips[i], 30);
303 ZeroMemory(&tbbutton, sizeof(TBBUTTON));
304 tbbutton.iString = (INT_PTR) tooltips[i];
305 tbbutton.fsStyle = TBSTYLE_CHECKGROUP;
306 tbbutton.fsState = TBSTATE_ENABLED | wrapnow;
307 tbbutton.idCommand = ID_FREESEL + i;
308 tbbutton.iBitmap = i;
309 SendMessage(hToolbar, TB_ADDBUTTONS, 1, (LPARAM) &tbbutton);
310 }
311
312 SendMessage(hToolbar, TB_CHECKBUTTON, ID_PEN, MAKELONG(TRUE, 0));
313 SendMessage(hToolbar, TB_SETMAXTEXTROWS, 0, 0);
314 SendMessage(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(25, 25));
315
316 /* creating the tool settings child window */
317 hToolSettings =
318 CreateWindowEx(0, _T("ToolSettings"), _T(""), WS_CHILD | WS_VISIBLE, 5, 208, 42, 140,
319 hToolBoxContainer, NULL, hThisInstance, NULL);
320 hTrackbarZoom =
321 CreateWindowEx(0, TRACKBAR_CLASS, _T(""), WS_CHILD | TBS_VERT | TBS_AUTOTICKS, 1, 1, 40, 64,
322 hToolSettings, NULL, hThisInstance, NULL);
323 SendMessage(hTrackbarZoom, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG(0, 6));
324 SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 3);
325
326 /* creating the palette child window */
327 hPalWin =
328 CreateWindowEx(0, _T("Palette"), _T(""), WS_CHILD | WS_VISIBLE, 56, 9, 255, 32, hwnd, NULL,
329 hThisInstance, NULL);
330
331 /* creating the scroll box */
332 hScrollbox =
333 CreateWindowEx(WS_EX_CLIENTEDGE, _T("Scrollbox"), _T(""),
334 WS_CHILD | WS_GROUP | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, 56, 49, 472, 248, hwnd,
335 NULL, hThisInstance, NULL);
336
337 /* creating the status bar */
338 hStatusBar =
339 CreateWindowEx(0, STATUSCLASSNAME, _T(""), SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd,
340 NULL, hThisInstance, NULL);
341 SendMessage(hStatusBar, SB_SETMINHEIGHT, 21, 0);
342
343 hScrlClient =
344 CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 500, 500, hScrollbox, NULL,
345 hThisInstance, NULL);
346
347 /* create selection window (initially hidden) */
348 hSelection =
349 CreateWindowEx(WS_EX_TRANSPARENT, _T("Selection"), _T(""), WS_CHILD | BS_OWNERDRAW, 350, 0, 100, 100,
350 hScrlClient, NULL, hThisInstance, NULL);
351
352 /* creating the window inside the scroll box, on which the image in hDrawingDC's bitmap is drawn */
353 hImageArea =
354 CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient,
355 NULL, hThisInstance, NULL);
356
357 hDC = GetDC(hImageArea);
358 hDrawingDC = CreateCompatibleDC(hDC);
359 hSelDC = CreateCompatibleDC(hDC);
360 ReleaseDC(hImageArea, hDC);
361 SelectObject(hDrawingDC, CreatePen(PS_SOLID, 0, fgColor));
362 SelectObject(hDrawingDC, CreateSolidBrush(bgColor));
363
364 hBms[0] = CreateDIBWithProperties(imgXRes, imgYRes);
365 SelectObject(hDrawingDC, hBms[0]);
366 Rectangle(hDrawingDC, 0 - 1, 0 - 1, imgXRes + 1, imgYRes + 1);
367
368 if (lpszArgument[0] != 0)
369 {
370 HBITMAP bmNew = NULL;
371 LoadDIBFromFile(&bmNew, lpszArgument, &fileTime, &fileSize, &fileHPPM, &fileVPPM);
372 if (bmNew != NULL)
373 {
374 TCHAR tempstr[1000];
375 TCHAR resstr[100];
376 TCHAR *temp;
377 insertReversible(bmNew);
378 GetFullPathName(lpszArgument, SIZEOF(filepathname), filepathname, &temp);
379 _tcscpy(filename, temp);
380 LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
381 _stprintf(tempstr, resstr, filename);
382 SetWindowText(hMainWnd, tempstr);
383 clearHistory();
384 isAFile = TRUE;
385 }
386 }
387
388 /* initializing the CHOOSECOLOR structure for use with ChooseColor */
389 choosecolor.lStructSize = sizeof(CHOOSECOLOR);
390 choosecolor.hwndOwner = hwnd;
391 choosecolor.hInstance = NULL;
392 choosecolor.rgbResult = 0x00ffffff;
393 choosecolor.lpCustColors = (COLORREF*) &custColors;
394 choosecolor.Flags = 0;
395 choosecolor.lCustData = 0;
396 choosecolor.lpfnHook = NULL;
397 choosecolor.lpTemplateName = NULL;
398
399 /* initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName */
400 CopyMemory(ofnFilename, filename, sizeof(filename));
401 LoadString(hThisInstance, IDS_OPENFILTER, ofnFilter, SIZEOF(ofnFilter));
402 for(c = ofnFilter; *c; c++)
403 if (*c == '\1')
404 *c = '\0';
405 ZeroMemory(&ofn, sizeof(OPENFILENAME));
406 ofn.lStructSize = sizeof(OPENFILENAME);
407 ofn.hwndOwner = hwnd;
408 ofn.hInstance = hThisInstance;
409 ofn.lpstrFilter = ofnFilter;
410 ofn.lpstrFile = ofnFilename;
411 ofn.nMaxFile = SIZEOF(ofnFilename);
412 ofn.lpstrFileTitle = ofnFiletitle;
413 ofn.nMaxFileTitle = SIZEOF(ofnFiletitle);
414 ofn.Flags = OFN_HIDEREADONLY;
415
416 CopyMemory(sfnFilename, filename, sizeof(filename));
417 LoadString(hThisInstance, IDS_SAVEFILTER, sfnFilter, SIZEOF(sfnFilter));
418 for(c = sfnFilter; *c; c++)
419 if (*c == '\1')
420 *c = '\0';
421 ZeroMemory(&sfn, sizeof(OPENFILENAME));
422 sfn.lStructSize = sizeof(OPENFILENAME);
423 sfn.hwndOwner = hwnd;
424 sfn.hInstance = hThisInstance;
425 sfn.lpstrFilter = sfnFilter;
426 sfn.lpstrFile = sfnFilename;
427 sfn.nMaxFile = SIZEOF(sfnFilename);
428 sfn.lpstrFileTitle = sfnFiletitle;
429 sfn.nMaxFileTitle = SIZEOF(sfnFiletitle);
430 sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
431
432 /* creating the size boxes */
433 hSizeboxLeftTop =
434 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
435 hThisInstance, NULL);
436 hSizeboxCenterTop =
437 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
438 hThisInstance, NULL);
439 hSizeboxRightTop =
440 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
441 hThisInstance, NULL);
442 hSizeboxLeftCenter =
443 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
444 hThisInstance, NULL);
445 hSizeboxRightCenter =
446 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
447 hThisInstance, NULL);
448 hSizeboxLeftBottom =
449 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
450 hThisInstance, NULL);
451 hSizeboxCenterBottom =
452 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
453 hThisInstance, NULL);
454 hSizeboxRightBottom =
455 CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
456 hThisInstance, NULL);
457 /* placing the size boxes around the image */
458 SendMessage(hImageArea, WM_SIZE, 0, 0);
459
460 /* by moving the window, the things in WM_SIZE are done */
461 MoveWindow(hwnd, 100, 100, 600, 450, TRUE);
462
463 /* Make the window visible on the screen */
464 ShowWindow (hwnd, nFunsterStil);
465
466 /* Run the message loop. It will run until GetMessage() returns 0 */
467 while (GetMessage(&messages, NULL, 0, 0))
468 {
469 TranslateAccelerator(hwnd, haccel, &messages);
470
471 /* Translate virtual-key messages into character messages */
472 TranslateMessage(&messages);
473 /* Send message to WindowProcedure */
474 DispatchMessage(&messages);
475 }
476
477 /* The program return-value is 0 - The value that PostQuitMessage() gave */
478 return messages.wParam;
479 }