| 131 | } |
| 132 | |
| 133 | HWND ResolveInputTargetWindow(HWND hwnd) { |
| 134 | if (!::IsWindow(hwnd)) |
| 135 | return nullptr; |
| 136 | |
| 137 | DWORD target_thread = ::GetWindowThreadProcessId(hwnd, nullptr); |
| 138 | if (target_thread != 0) { |
| 139 | GUITHREADINFO gti = {0}; |
| 140 | gti.cbSize = sizeof(gti); |
| 141 | if (::GetGUIThreadInfo(target_thread, >i)) { |
| 142 | if (::IsWindow(gti.hwndFocus) && (gti.hwndFocus == hwnd || ::IsChild(hwnd, gti.hwndFocus))) |
| 143 | return gti.hwndFocus; |
| 144 | if (::IsWindow(gti.hwndActive) && (gti.hwndActive == hwnd || ::IsChild(hwnd, gti.hwndActive))) |
| 145 | return gti.hwndActive; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | return hwnd; |
| 150 | } |
| 151 | |
| 152 | bool SendCharMessage(HWND hwnd, UINT msg, wchar_t ch) { |
| 153 | DWORD_PTR result = 0; |
no outgoing calls
no test coverage detected