| 46 | } |
| 47 | |
| 48 | void StaticDialog::display(bool toShow, bool activate) const { |
| 49 | if (toShow) { |
| 50 | // If the user has switched from a dual monitor to a single monitor since we last |
| 51 | // displayed the dialog, then ensure that it's still visible on the single monitor. |
| 52 | RECT workAreaRect, rc; |
| 53 | ::SystemParametersInfo(SPI_GETWORKAREA, 0, &workAreaRect, 0); |
| 54 | ::GetWindowRect(_hSelf, &rc); |
| 55 | int newLeft = rc.left; |
| 56 | int newTop = rc.top; |
| 57 | int margin = ::GetSystemMetrics(SM_CYSMCAPTION); |
| 58 | if (newLeft > ::GetSystemMetrics(SM_CXVIRTUALSCREEN) - margin) |
| 59 | newLeft -= rc.right - workAreaRect.right; |
| 60 | if (newLeft + (rc.right - rc.left) < ::GetSystemMetrics(SM_XVIRTUALSCREEN) + margin) |
| 61 | newLeft = workAreaRect.left; |
| 62 | if (newTop > ::GetSystemMetrics(SM_CYVIRTUALSCREEN) - margin) |
| 63 | newTop -= rc.bottom - workAreaRect.bottom; |
| 64 | if (newTop + (rc.bottom - rc.top) < ::GetSystemMetrics(SM_YVIRTUALSCREEN) + margin) |
| 65 | newTop = workAreaRect.top; |
| 66 | |
| 67 | if ((newLeft != rc.left) || (newTop != rc.top)) // then the virtual screen size has shrunk |
| 68 | // Remember that MoveWindow wants width/height. |
| 69 | ::MoveWindow(_hSelf, newLeft, newTop, rc.right - rc.left, rc.bottom - rc.top, TRUE); |
| 70 | } |
| 71 | |
| 72 | Window::display(toShow, activate); |
| 73 | } |
| 74 | |
| 75 | HGLOBAL StaticDialog::makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplate) { |
| 76 | // Get Dlg Template resource |
no outgoing calls
no test coverage detected