| 560 | } |
| 561 | |
| 562 | void |
| 563 | onCreate(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 | |
| 599 | void |
| 600 | mswin_message_window_size(HWND hWnd, LPSIZE sz) |
no test coverage detected