6 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
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.
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.
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.
26 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
43 ////////////////////////////////////////////////////////////////////////////////
54 TCHAR szTitle
[MAX_LOADSTRING
];
55 TCHAR szFrameClass
[MAX_LOADSTRING
];
56 TCHAR szChildClass
[MAX_LOADSTRING
];
59 ////////////////////////////////////////////////////////////////////////////////
62 // FUNCTION: InitInstance(HANDLE, int)
64 // PURPOSE: Saves instance handle and creates main window
68 // In this function, we save the instance handle in a global variable and
69 // create and display the main program window.
71 BOOL
InitInstance(HINSTANCE hInstance
, int nCmdShow
)
73 WNDCLASSEX wcFrame
= {
75 CS_HREDRAW
| CS_VREDRAW
/*style*/,
80 LoadIcon(hInstance
, MAKEINTRESOURCE(IDI_REGEDT32
)),
81 LoadCursor(0, IDC_ARROW
),
85 (HICON
)LoadImage(hInstance
, MAKEINTRESOURCE(IDI_REGEDT32
), IMAGE_ICON
,
86 GetSystemMetrics(SM_CXSMICON
), GetSystemMetrics(SM_CYSMICON
), LR_SHARED
)
88 ATOM hFrameWndClass
= RegisterClassEx(&wcFrame
); // register frame window class
90 WNDCLASSEX wcChild
= {
92 CS_HREDRAW
| CS_VREDRAW
| CS_NOCLOSE
/*style*/,
95 sizeof(HANDLE
)/*cbWndExtra*/,
97 LoadIcon(hInstance
, MAKEINTRESOURCE(IDI_REGEDT32
)),
98 LoadCursor(0, IDC_ARROW
),
102 (HICON
)LoadImage(hInstance
, MAKEINTRESOURCE(IDI_REGEDT32
), IMAGE_ICON
,
103 GetSystemMetrics(SM_CXSMICON
), GetSystemMetrics(SM_CYSMICON
), LR_SHARED
)
106 ATOM hChildWndClass
= RegisterClassEx(&wcChild
); // register child windows class
108 hMenuFrame
= LoadMenu(hInstance
, MAKEINTRESOURCE(IDR_REGEDT32_MENU
));
109 // hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_REGEDT32));
111 // Initialize the Windows Common Controls DLL
112 InitCommonControls();
114 hFrameWnd
= CreateWindowEx(0, (LPCTSTR
)(int)hFrameWndClass
, szTitle
,
115 WS_OVERLAPPEDWINDOW
| WS_CLIPCHILDREN
,
116 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
,
117 NULL
, hMenuFrame
, hInstance
, NULL
/*lpParam*/);
122 // Create the status bar
123 hStatusBar
= CreateStatusWindow(WS_VISIBLE
|WS_CHILD
|WS_CLIPSIBLINGS
|SBT_NOBORDERS
,
124 _T(""), hFrameWnd
, STATUS_WINDOW
);
126 // Create the status bar panes
127 SetupStatusBar(hFrameWnd
, FALSE
);
128 CheckMenuItem(GetSubMenu(hMenuFrame
, ID_VIEW_MENU
), ID_VIEW_STATUSBAR
, MF_BYCOMMAND
|MF_CHECKED
);
130 ShowWindow(hFrameWnd
, nCmdShow
);
131 UpdateWindow(hFrameWnd
);
135 ////////////////////////////////////////////////////////////////////////////////
137 void ExitInstance(void)
139 DestroyMenu(hMenuFrame
);
142 int APIENTRY
WinMain(HINSTANCE hInstance
,
143 HINSTANCE hPrevInstance
,
151 // Initialize global strings
152 LoadString(hInstance
, IDS_APP_TITLE
, szTitle
, MAX_LOADSTRING
);
153 LoadString(hInstance
, IDC_REGEDT32_FRAME
, szFrameClass
, MAX_LOADSTRING
);
154 LoadString(hInstance
, IDC_REGEDT32
, szChildClass
, MAX_LOADSTRING
);
156 // Store instance handle in our global variable
159 // Load our settings from the registry
162 // Perform application initialization:
163 if (!InitInstance(hInstance
, nCmdShow
)) {
166 // hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDT32);
167 hMDIClient
= GetWindow(hFrameWnd
, GW_CHILD
);
169 // Main message loop:
170 while (GetMessage(&msg
, (HWND
)NULL
, 0, 0)) {
171 if (!TranslateMDISysAccel(hMDIClient
, &msg
) &&
172 !TranslateAccelerator(hFrameWnd
, hAccel
, &msg
)) {
173 TranslateMessage(&msg
);
174 DispatchMessage(&msg
);
177 // Save our settings to the registry