wpf 如何禁用屏幕键盘的 Win 键?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21254759/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 10:33:54  来源:igfitidea点击:

How to disable Win key of on-screen keyboard?

c#.netwpf

提问by Niloo

I have a app that use in a kiosk. I disable task-bar and win key in registry with SetWindowsHookEx.

我有一个在自助服务终端中使用的应用程序。我禁用任务栏并在注册表中使用SetWindowsHookEx.

But can open startmenu when use On-Screan keyboard. I use PreviewKeyDownevent, but don't work.

但使用屏幕键盘时可以打开开始菜单。我使用PreviewKeyDown事件,但不起作用。

private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
 {
  if (e.Key == Key.LWin || e.Key==Key.RWin)
     e.Handled = true;
 }

How to disable win key of on-screan keyboard?

如何禁用屏幕键盘的win键?

采纳答案by owen79

This person seems to have it sorted http://sleepydesign.blogspot.co.uk/2013/07/c-disable-system-keys-on-windows-on.html

这个人似乎已经排序http://sleepydesign.blogspot.co.uk/2013/07/c-disable-system-keys-on-windows-on.html

But the appear from their githubto be using the same approach to hooks

但是从他们的github看来使用相同的方法来挂钩

I imagine my scan of the code missed something, they're quite confident it works, explicitly refering to the onscreen keyboard and disabling specific functionality .

我想我对代码的扫描遗漏了一些东西,他们非常有信心它可以工作,明确引用屏幕键盘并禁用特定功能。

I believe he virtual code for windows key is

我相信他的 Windows 键的虚拟代码是

MOD_WIN      (0x0008)

Also take a look at RegisterHotKey

也看看RegisterHotKey