用于控制虚拟键盘的系统命令? (使用C#) [英] System Commands to control Virtual Keyboard? (Using C#)

查看:118
本文介绍了用于控制虚拟键盘的系统命令? (使用C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原帖:


所以,

在开发方面,我们都在发展成触摸屏领域 无论我们是设计遗留的WinForms应用程序,WPF还是新的Metro Style应用程序,都需要处理用户输入。 现在通常通过"软"提供此输入
。 。键盘 虚拟图像/按钮屏幕允许我们键入(尽管效率低于我的分割键ergo)到任何文本框,组合框,备忘录或富文本控件。


但我们的控制在哪里?


如果我在Asus Transporter Book上手动打开键盘,右下方会出现一个图标,允许我选择可用的键盘类型。 标准的Windows QWERTY,带有alt,ctrl和winkey,或更简单的"平板电脑"。
键盘,只包含字母,数字,移位和表情符号。 


如果我不希望用户控制此内容怎么办? 


如果我想要用户输入怎么办,但对于Kiosk应用程序的情况,我不能让用户使用Alt + Tab,或WinKey + R等等。 我只是希望他们能够输入文字,而不是改变输入风格或影响操作系统。 如果我想要
更改键盘的尺寸,当它显示时怎么办? 或者调整视觉"移位"。当键盘变为可见时,我的应用程序是什么?


如果不通过系统命令从头创建我自己的虚拟键盘到Window的子系统,这是否可行? 是否有用于Windows 8-10的虚拟键盘控制模块?


谢谢


Jaeden" Sifo Dyas" al'Raec Ruiner


MSDN回复


您好JaedenRuiner,


Visual C#论坛讨论并询问有关C#编程语言,IDE,库,示例和工具的问题。你的问题与它无关。我建议您在下面的网站上提出您的问题以获得更好的帮助。

http ://answers.microsoft.com/en-us/windowslive/forum?tab =主题


最好的问候,

Li Wang


我不同意。


我想知道如何控制通过C#程序在Windows操作系统中使用软键盘,那还有什么用呢?  .Net Framework可能?


将这个主题移到主题上会完全破坏任何人回答它的机会,所以我将它重新发布回它所属的C#论坛。


您发送给我的论坛是用于在Windows基础知识中打开或关闭它。我问如何通过程序选择键盘。在我的Android手机上,一些输入会显示"数字键盘"。键盘,因为输入只允许电话号码。其他
键盘存在于具有"表情符号"的窗口中。选择器位于空格键旁边,其他选项卡没有Alt或Win键。这些都是Windows操作系统中存在的
程序选择或控制的软件键盘。


所以现在,因为在这个线程中被移动了到"死信办公室"我将不得不创建自己的"软键盘"。从头开始使用命中测试。我可以做到,但这将是一个皇家的痛苦,因为我的问题是错误的。
键盘是一个系统级控件,由于一切都在移动到触摸屏,Windows 8.1和10都内置了软件键盘。如果我的问题是"如何捕获系统密钥序列"?我得到了不是特定于C#的帮助,但它是特定于Windows API的
,可以用C#编程。从这个人开始指向编程系统键盘钩子的方向,并解析全局WM_KEYDOWN消息,瞧,通过代码我可以通过这个键盘钩子阻止Alt + Tab和Ctrl + Alt + Del
。根据MSDN的回复,这不是一个C#问题,但是我已经在C#论坛得到了类似问题的答案,因为问题没有被移动。


所以我是重申这个"系统编程问题"我希望用C#方式回答,如果这还不够,请将其移到不存在的"Win API"中。论坛。


所以"编程"问题:软件键盘是否可以通过使用C#的系统命令进行控制,如果是,我该如何操作。


谢谢你,
Jaeden" Sifo Dyas" al'Raec Ruiner




"绝不相信计算机。你的大脑比任何微芯片都聪明。"


PS - 不要在其他人的问题上标记答案。有假期和假期这样的事情可能会减少及时的活动,直到提出问题的人可以测试你的答案,这只是因为你认为它是不正确的。将它标记为
对它们的正确性通常会阻止其他人阅读问题,并可能提供真实的"正确"信息。回答。

解决方案

JaedenRuiner,


>>可以使用C#通过系统命令控制软件键盘,如果是,我该怎么做。


你能不能首先澄清"系统命令"是什么意思?


如果您只想使用C#代码来控制虚拟键盘,可以使用以下代码打开它。


Process 。开始( 环境 。GetFolderPath( 环境 SpecialFolder 。系统)
+
路径 。DirectorySeparatorChar +
" osk.exe" );


关于如何禁用屏幕键盘的某些键,可以使用以下线程。


http://stackoverflow.com/ question / 21254759 / how-to-disable-win-win-key-of-screen-keyboard


此外,以下主题讨论了屏幕键盘和你可以参考。


https://social.msdn.microsoft.com/Forums/vstudio/en-US/8f6a0d40-218e-43be-a432-4c1e3c84bdca/on -screen-keyboard-control-api-for-wpf?forum = wpf


最好的问候,


Albert Zhang


Original Post:

So,
We are all evolving into the Touchscreen universe when it comes to development.  Whether we're designing a legacy WinForms app, WPF, or a new Metro Style application, there is an intrinsic need to handle user input.  This input is now often provided by way of the "soft" keyboard.  The virtual image/button screen that allows us to type (albeit less efficiently than my split key ergo) into any textbox, combobox, memo or rich text control.

But where is our control?

If I manually open the keyboard on my Asus Transporter Book, there is an icon in the bottom right that allows me to select the type of keyboard available.  The standard Windows QWERTY, with alt, ctrl, and winkey, or the more simplistic "tablet" keyboard, with just letters, numbers, shift and emojis. 

What if I don't want the user to control this? 

What if I want to have user input, but for the situation of a Kiosk App, I can't let the user Alt+Tab, or WinKey+R, etc.  I just want them to be able to type text, and not change the input style or affect the OS in anyway.  What if I want to change the dimensions of the keyboard, when it displays?  Or adjust the visual "shift" of my app when keyboard becomes visible?

Is this possible without creating my own virtual keyboard from scratch to do this via system commands to the Window's subsystem?  Is there a virtual keyboard control module for windows 8-10?

Thanks

Jaeden "Sifo Dyas" al'Raec Ruiner

MSDN Response

Hi JaedenRuiner,

Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools. Your question is not related to it. I suggest you ask your question on below site for better help.
http://answers.microsoft.com/en-us/windowslive/forum?tab=Threads

Best Regards,
Li Wang

I beg to differ.

I want to figure out how to control the Soft Keyboard in the Windows OS via a C# program, so where else would that go?  .Net Framework maybe?

Moving this thread to off topic completely destroys any chance for anyone to answer it, so I am reposting it back in the C# forum where it DOES belong.

The forum you sent me to is for turning it on or off in windows basics. I am asking how to select a keyboard through a program. On my Android phone, some inputs bring up the "number pad" keyboard, because the input only allows phone numbers. Other keyboards exist in windows that have the "emoticon" selector in the bottom next to the space bar, and others don't have the Alt or Win keys. These are all software keyboards that exist in the Windows OS that the program selects or controls.

So right now, since in this thread got moved to the "dead letter office" I am going to have to create my own "soft keyboard" from scratch using hit tests. I can do it, but it will be a royal pain because my question was moved in error. The keyboard is a system level control, and since everything is moving to touch screen Windows 8.1 and 10 have built in software keyboard. If my question was "How can I trap a system key sequence" I get help that is not specific to C#, but it is specific to Windows API which can be programmed in C#. From this people point me in the direction of programming a System Keyboard Hook, and parsing the global WM_KEYDOWN messages, and voila, through code I can prevent Alt+Tab, and Ctrl+Alt+Del via this keyboard hook. According to the MSDN response, that would not be a C# question, but I've gotten answers to questions like that in the C# forum because the question wasn't moved.

So I am reiterating this "System Programming Question" which I want answered in a C# way, which if that does not suffice, please move it to the non-existent "Win API" forum.

So "Programming" question: Can the Software Keyboard be controlled via system commands using C#, and if so How do I do that.

Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner


"Never Trust a computer. Your brain is smarter than any micro-chip."
PS - Don't mark answers on other people's questions. There are such things as Vacations and Holidays which may reduce timely activity, and until the person asking the question can test your answer, it is not correct just because you think it is. Marking it correct for them often stops other people from even reading the question and possibly providing the real "correct" answer.

解决方案

Hi JaedenRuiner,

>>Can the Software Keyboard be controlled via system commands using C#, and if so How do I do that.

Could you first clarify what does the "system commands" mean?

If you want just want to use C# code to control the Virtual Keyboard, you could use the following code to open it.

Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe");

About how to disable some keys of the on-screen keyboard, you could have the following thread.

http://stackoverflow.com/questions/21254759/how-to-disable-win-key-of-on-screen-keyboard

Besides, the following thread talks about the on-screen keyboard and you could refer to.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/8f6a0d40-218e-43be-a432-4c1e3c84bdca/on-screen-keyboard-control-api-for-wpf?forum=wpf

Best Regards,

Albert Zhang


这篇关于用于控制虚拟键盘的系统命令? (使用C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆