| 143 | } |
| 144 | |
| 145 | float window::get_scaling(void *hwnd) |
| 146 | { |
| 147 | const int MDT_EFFECTIVE_DPI = 0; |
| 148 | auto getDpiForMonitor = getfunc("shcore.dll", GetDpiForMonitor); |
| 149 | |
| 150 | int dpi = 0; |
| 151 | if (getDpiForMonitor) { |
| 152 | UINT hdpi_uint, vdpi_uint; |
| 153 | HMONITOR hmom = MonitorFromWindow(static_cast<HWND>(hwnd), MONITOR_DEFAULTTONEAREST); |
| 154 | if (getDpiForMonitor(hmom, MDT_EFFECTIVE_DPI, &hdpi_uint, &vdpi_uint) == S_OK) { |
| 155 | dpi = static_cast<int>(hdpi_uint); |
| 156 | } |
| 157 | } |
| 158 | else { |
| 159 | HDC hdc = GetDC(NULL); |
| 160 | if (hdc) { |
| 161 | dpi = GetDeviceCaps(hdc, LOGPIXELSX); |
| 162 | ReleaseDC(NULL, hdc); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | if (dpi == 0) |
| 167 | dpi = 96; |
| 168 | |
| 169 | return dpi / 96.0f; |
| 170 | } |
| 171 | |
| 172 | void window::make_foreground(void *hwnd) |
| 173 | { |
nothing calls this directly
no outgoing calls
no test coverage detected