[英]How to close windows on screen keyboard with c++
I'm trying to close windows on-screen keyboard (osk.exe) in c++ code, but without any success. 我试图用c ++代码关闭Windows屏幕键盘(osk.exe),但没有任何成功。
HWND kbIsOpen = FindWindow(TEXT("OSKMainClass"),NULL);
CloseWindow(kbIsOpen);
CloseWindow
or SendMessage
didn't to anything. CloseWindow
或SendMessage
没有任何东西。 Note that the problem is not in kbIsOpen
, and also getLastError
returns 5 (ERROR_ACCESS_DENIED)
. 请注意,问题不在kbIsOpen
,并且getLastError
也返回5 (ERROR_ACCESS_DENIED)
。
What I can do to deal with this problem? 我能做些什么来处理这个问题?
Assuming FindWindow
returns a valid window handle, SendMessage(kbIsOpen, WM_DESTROY, NULL, NULL);
假设FindWindow
返回一个有效的窗口句柄, SendMessage(kbIsOpen, WM_DESTROY, NULL, NULL);
should close it. 应该关闭它。 (Although it's kind of a dangerous way to do it. Try sending WM_CLOSE
and WM_QUIT
first.) (虽然这是一种危险的方法。首先尝试发送WM_CLOSE
和WM_QUIT
。)
However, it's possible that the keyboard window throws away destroy messages, and just keeps on going no matter what you throw at it. 然而,键盘窗口可能会抛弃破坏消息,并且无论你向它投掷什么,它都会继续前进。 I'm running Windows 7, so I can't tell you myself. 我正在运行Windows 7,所以我不能告诉你自己。
< unimportant opinion > bkIsOpen
sounds like the name of a boolean variable telling you if the window is open, not a handle to the window if it exists. < bkIsOpen
opinion> bkIsOpen
听起来像一个布尔变量的名称,告诉你窗口是否打开,如果它存在,则不是窗口的句柄。 < /unimportant opinion > </不重要的意见>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.