MCPcopy Create free account
hub / github.com/NetHack/NetHack / MainWndProc

Function MainWndProc

outdated/sys/wince/mhmain.c:168–515  ·  view source on GitHub ↗

// FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. */

Source from the content-addressed store, hash-verified

166// PURPOSE: Processes messages for the main window.
167*/
168LRESULT CALLBACK
169MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
170{
171 PNHMainWindow data;
172
173 switch (message) {
174 /*-----------------------------------------------------------------------*/
175 case WM_CREATE: {
176#if defined(WIN_CE_POCKETPC) || defined(WIN_CE_SMARTPHONE)
177 SHMENUBARINFO menubar;
178#endif
179 /* set window data */
180 data = (PNHMainWindow) malloc(sizeof(NHMainWindow));
181 if (!data)
182 panic("out of memory");
183 ZeroMemory(data, sizeof(NHMainWindow));
184 data->mapAcsiiModeSave = MAP_MODE_ASCII12x16;
185 SetWindowLong(hWnd, GWL_USERDATA, (LONG) data);
186
187 GetNHApp()->hMainWnd = hWnd;
188
189/* create menu bar */
190#if defined(WIN_CE_POCKETPC) || defined(WIN_CE_SMARTPHONE)
191 ZeroMemory(&menubar, sizeof(menubar));
192 menubar.cbSize = sizeof(menubar);
193 menubar.hwndParent = hWnd;
194 menubar.dwFlags = 0;
195 menubar.nToolBarId = IDC_WINHACK;
196 menubar.hInstRes = GetNHApp()->hApp;
197#if defined(WIN_CE_POCKETPC)
198 menubar.nBmpId = IDB_MENUBAR;
199 menubar.cBmpImages = 2;
200#else
201 menubar.nBmpId = 0;
202 menubar.cBmpImages = 0;
203#endif
204 if (!SHCreateMenuBar(&menubar))
205 panic("cannot create menu");
206 GetNHApp()->hMenuBar = menubar.hwndMB;
207#else
208 GetNHApp()->hMenuBar = CommandBar_Create(GetNHApp()->hApp, hWnd, 1);
209 if (!GetNHApp()->hMenuBar)
210 panic("cannot create menu");
211 CommandBar_InsertMenubar(GetNHApp()->hMenuBar, GetNHApp()->hApp,
212 IDC_WINHACK, 0);
213#endif
214 CheckMenuItem(
215 _get_main_menu(ID_VIEW), IDM_VIEW_KEYPAD,
216 MF_BYCOMMAND | (GetNHApp()->bCmdPad ? MF_CHECKED : MF_UNCHECKED));
217
218 } break;
219
220 /*-----------------------------------------------------------------------*/
221
222 case WM_MSNH_COMMAND:
223 onMSNHCommand(hWnd, wParam, lParam);
224 break;
225

Callers

nothing calls this directly

Calls 13

_get_main_menuFunction · 0.85
mswin_map_get_cursorFunction · 0.85
hangupFunction · 0.85
dosave0Function · 0.85
GetNHAppFunction · 0.70
onMSNHCommandFunction · 0.70
mswin_hwnd_from_winidFunction · 0.70
mswin_select_map_modeFunction · 0.70
onWMCommandFunction · 0.70
mswin_layout_main_windowFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected