Vendor import of shfolder
[reactos.git] / rosapps / devutils / zoomin / main.c
1 /*
2 * ReactOS zoomin
3 *
4 * main.c
5 *
6 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
24 #include <windows.h>
25 #include <tchar.h>
26 #include <stdlib.h>
27 #include <stdio.h>
28
29 #include "main.h"
30 #include "framewnd.h"
31
32
33 ////////////////////////////////////////////////////////////////////////////////
34 // Global Variables:
35 //
36
37 HINSTANCE hInst;
38 HWND hFrameWnd;
39 HMENU hMenuFrame;
40
41 TCHAR szTitle[MAX_LOADSTRING];
42 TCHAR szFrameClass[MAX_LOADSTRING];
43
44
45 ////////////////////////////////////////////////////////////////////////////////
46 //
47 //
48 // FUNCTION: InitInstance(HANDLE, int)
49 //
50 // PURPOSE: Saves instance handle and creates main window
51 //
52 // COMMENTS:
53 //
54 // In this function, we save the instance handle in a global variable and
55 // create and display the main program window.
56 //
57
58 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
59 {
60 WNDCLASSEX wcFrame = {
61 sizeof(WNDCLASSEX),
62 CS_HREDRAW | CS_VREDRAW/*style*/,
63 FrameWndProc,
64 0/*cbClsExtra*/,
65 0/*cbWndExtra*/,
66 hInstance,
67 LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN)),
68 LoadCursor(0, IDC_ARROW),
69 0/*hbrBackground*/,
70 0/*lpszMenuName*/,
71 szFrameClass,
72 (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN), IMAGE_ICON,
73 GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
74 };
75 ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
76
77 hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_ZOOMIN_MENU));
78
79 hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
80 WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
81 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
82 NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
83
84 if (!hFrameWnd) {
85 return FALSE;
86 }
87
88 ShowWindow(hFrameWnd, nCmdShow);
89 UpdateWindow(hFrameWnd);
90 return TRUE;
91 }
92
93 ////////////////////////////////////////////////////////////////////////////////
94
95 void ExitInstance(void)
96 {
97 DestroyMenu(hMenuFrame);
98 }
99
100
101 int APIENTRY WinMain(HINSTANCE hInstance,
102 HINSTANCE hPrevInstance,
103 LPSTR lpCmdLine,
104 int nCmdShow)
105 {
106 MSG msg;
107 HACCEL hAccel;
108
109 // Initialize global strings
110 LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
111 LoadString(hInstance, IDC_ZOOMIN, szFrameClass, MAX_LOADSTRING);
112
113 // Store instance handle in our global variable
114 hInst = hInstance;
115
116 // Perform application initialization:
117 if (!InitInstance(hInstance, nCmdShow)) {
118 return FALSE;
119 }
120 hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_ZOOMIN);
121
122 // Main message loop:
123 while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
124 if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) {
125 TranslateMessage(&msg);
126 DispatchMessage(&msg);
127 }
128 }
129 ExitInstance();
130 return msg.wParam;
131 }
132