diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp index eac3ae45..8f717504 100644 --- a/src/frameworks/UBPlatformUtils_win.cpp +++ b/src/frameworks/UBPlatformUtils_win.cpp @@ -439,11 +439,19 @@ void UBPlatformUtils::showFullScreen(QWidget *pWidget) void UBPlatformUtils::showOSK(bool show) { - Q_UNUSED(show); - - QString windir = qgetenv("WINDIR"); - QString osk_path = windir+"\\System32\\osk.exe"; - - QProcess newProcess; - newProcess.startDetached("explorer.exe", QStringList() << osk_path); + if (show) { + QString windir = qgetenv("WINDIR"); + QString osk_path = windir+"\\System32\\osk.exe"; + + QProcess oskProcess; + // We have to pass by explorer.exe because osk.exe can only be launched + // directly with administrator rights + oskProcess.startDetached("explorer.exe", QStringList() << osk_path); + } + + else { + HWND oskWindow = ::FindWindow(TEXT("OSKMainClass"), NULL); + if (oskWindow) + PostMessage(oskWindow, WM_SYSCOMMAND, SC_CLOSE, 0); + } }