| 274 | } |
| 275 | |
| 276 | bool MainApplication::ShowScreenKeyboard() |
| 277 | { |
| 278 | #if defined(DEATH_TARGET_WINDOWS) |
| 279 | if (::FindWindowEx(NULL, NULL, L"IPTip_Main_Window", NULL) != NULL) { |
| 280 | // IID_ITipInvocation is supported only on Windows 10 and later |
| 281 | ITipInvocation* tip; |
| 282 | if (::CoCreateInstance(CLSID_UIHostNoLaunch, nullptr, |
| 283 | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**)&tip) == S_OK) { |
| 284 | HRESULT hr = tip->Toggle(::GetDesktopWindow()); |
| 285 | tip->Release(); |
| 286 | return SUCCEEDED(hr); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | // Create the process directly if the above fails on Windows 7 |
| 291 | # if defined(DEATH_TARGET_32BIT) |
| 292 | PVOID redirectOldValue = nullptr; |
| 293 | BOOL redirectSuccess = ::Wow64DisableWow64FsRedirection(&redirectOldValue); |
| 294 | # endif |
| 295 | bool success = false; |
| 296 | wchar_t rawPath[MAX_PATH]; |
| 297 | if (GetTabTipPathFromRegistry(rawPath, DWORD(arraySize(rawPath))) == 0) { |
| 298 | wcscpy_s(rawPath, L"\"%CommonProgramFiles%\\Microsoft Shared\\Ink\\TabTip.exe\""); |
| 299 | } |
| 300 | wchar_t path[MAX_PATH]; |
| 301 | DWORD pathLength = ::ExpandEnvironmentStringsW(rawPath, path, DWORD(arraySize(path))); |
| 302 | if (pathLength > 0 && pathLength < DWORD(arraySize(path))) { |
| 303 | HINSTANCE hinst = ::ShellExecuteW(NULL, L"open", path, |
| 304 | nullptr, nullptr, SW_SHOWNORMAL); |
| 305 | success = ((INT_PTR)hinst > 32); |
| 306 | } |
| 307 | # if defined(DEATH_TARGET_32BIT) |
| 308 | if (redirectSuccess) { |
| 309 | ::Wow64RevertWow64FsRedirection(redirectOldValue); |
| 310 | } |
| 311 | # endif |
| 312 | return success; |
| 313 | #else |
| 314 | return false; |
| 315 | #endif |
| 316 | } |
| 317 | |
| 318 | bool MainApplication::HideScreenKeyboard() |
| 319 | { |
nothing calls this directly
no test coverage detected