打开、关闭系统软键盘(触摸屏)

开启、关闭系统软键盘

调用头文件
#include
#pragma comment(lib, “user32.lib”)

void OpenSystemOskSlot()
{
/如果已开启则跳过/
HWND appWnd;
appWnd = ::FindWindow(L"OSKMainClass", NULL);
if (appWnd)
{
return;
}

PVOID OldValue;
BOOL bRet = Wow64DisableWow64FsRedirection(&OldValue);
if (bRet)
 {
	  QString csProcess = "C:\\Windows\\System32\\osk.exe";
	  QString params = "";

	 ShellExecute(NULL, L"open", (LPCWSTR)csProcess.utf16(), 			(LPCWSTR)params.utf16(), NULL, SW_SHOWNORMAL);

printf(“2**\n”);
Wow64RevertWow64FsRedirection(OldValue);
}
}
/关闭系统软键盘/
CloseSystemOSKSlot()
{
HWND appWnd;
appWnd = ::FindWindow(L"OSKMainClass",NULL);

if (appWnd)
{
SendMessage(appWnd,WM_SYSCOMMAND,SC_CLOSE,0);
qDebug() << “close keyboard succeed\n”;
}
else
{
qDebug() << “close keyboard false\n”;
}
}

/开启触摸屏软键盘/
QProcess pro;
 pro.startDetached(“C:/Program Files/Common Files/Microsoft Shared/ink/TabTip.exe”, QStringList());

你可能感兴趣的:(Qt,触摸屏,软键盘,OSK,TabTip)