简体   繁体   English

C#复制/粘贴具有不同的快捷方式

[英]C# Copy / Paste with different shortcuts

I would like to create a global listener for keyboard input that will allow users to copy and paste data into the clipboard with their own user defined shortcuts. 我想为键盘输入创建一个全局侦听器,该侦听器将允许用户使用自己定义的快捷方式将数据复制并粘贴到剪贴板中。 I will demonstrate what I need with an example. 我将通过一个例子演示我的需求。

Say I am a user who wants to copy three different numbers on three different text boxes within internet explorer. 假设我是一个用户,想要在Internet Explorer的三个不同的文本框中复制三个不同的数字。 The user highlights the first text box and presses alt-1, does the same with alt-2 for the second and alt-3 for the third. 用户突出显示第一个文本框并按alt-1,对第二个和第二个按alt-2,对第三个按alt-3。 For each shortcut, clipboard data is copied into my application in different fields. 对于每个快捷方式,剪贴板数据都在不同字段中复制到我的应用程序中。 Any ideas as to how I can approach this? 关于如何解决这个问题有什么想法吗?

This is ac# winforms application developed in VS2010. 这是在VS2010中开发的ac#winforms应用程序。

I would start with something like this: 我将从以下内容开始:

http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx

This is a global keyboard hook that will work even when your application has no focus. 这是一个全局键盘钩子,即使您的应用程序没有焦点也可以使用。 It wraps native dll's though but there is no other way around it if you want a global hook I think. 虽然它包装了本地dll,但是如果您想使用全局钩子,没有其他方法可以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM