MCPcopy Create free account
hub / github.com/WallBreaker2/op / ResolveInputTargetWindow

Function ResolveInputTargetWindow

libop/window/WindowText.cpp:133–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133HWND 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, &gti)) {
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
152bool SendCharMessage(HWND hwnd, UINT msg, wchar_t ch) {
153 DWORD_PTR result = 0;

Callers 2

SendStringMethod · 0.85
SendStringImeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected