系统屏幕键盘(软键盘)打开和关闭
// 打开软键盘
bool OpenOSK()
{
HWND appWnd = ::FindWindow(L"OSKMainClass", NULL);
if (appWnd == NULL)
{
// 打开系统软键盘
PVOID OldValue;
BOOL bRet = Wow64DisableWow64FsRedirection(&OldValue);
QString csProcess = “C:\Windows\System32\osk.exe”;// 软键盘启动程序所在目录
QString params = “”;
HINSTANCE hOsk = ShellExecute(NULL, L"open", (LPCWSTR)csProcess.utf16(), (LPCWSTR)params.utf16(), NULL, SW_SHOWNORMAL);
if (bRet)
{
Wow64RevertWow64FsRedirection(OldValue);
}
return hOsk != NULL;
}
else
return true;
}
// 关闭软键盘
bool CloseOSK()
{
// 关掉系统软键盘
HWND appWnd = ::FindWindow(L"OSKMainClass", NULL);
if (appWnd)
{
SendMessage(appWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
}
else
{
return false;
}
return true;
}
如果觉得《系统屏幕键盘(软键盘)打开和关闭》对你有帮助,请点赞、收藏,并留下你的观点哦!