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

Function onCreate

outdated/sys/wince/mhmsgwnd.c:562–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562void
563onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
564{
565 HDC hdc;
566 TEXTMETRIC tm;
567 PNHMessageWindow data;
568 HGDIOBJ saveFont;
569
570 /* set window data */
571 data = (PNHMessageWindow) malloc(sizeof(NHMessageWindow));
572 if (!data)
573 panic("out of memory");
574 ZeroMemory(data, sizeof(NHMessageWindow));
575 data->max_text = MAXWINDOWTEXT;
576 SetWindowLong(hWnd, GWL_USERDATA, (LONG) data);
577
578 /* Get the handle to the client area's device context. */
579 hdc = GetDC(hWnd);
580 saveFont =
581 SelectObject(hdc, mswin_get_font(NHW_MESSAGE, ATR_NONE, hdc, FALSE));
582
583 /* Extract font dimensions from the text metrics. */
584 GetTextMetrics(hdc, &tm);
585 data->xChar = tm.tmAveCharWidth;
586 data->xUpper = (tm.tmPitchAndFamily & 1 ? 3 : 2) * data->xChar / 2;
587 data->yChar = tm.tmHeight + tm.tmExternalLeading;
588 data->xPage = 1;
589
590 /* Free the device context. */
591 SelectObject(hdc, saveFont);
592 ReleaseDC(hWnd, hdc);
593
594 /* create command pad (keyboard emulator) */
595 if (!GetNHApp()->hCmdWnd)
596 GetNHApp()->hCmdWnd = mswin_init_command_window();
597}
598
599void
600mswin_message_window_size(HWND hWnd, LPSIZE sz)

Callers 1

NHMessageWndProcFunction · 0.70

Calls 4

mswin_get_fontFunction · 0.70
GetNHAppFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected