如何用热键粘贴?
我必须在工作中解决一个问题,他们需要几个热键,每个热键必须完成一项特定的任务。即使应用程序没有焦点,这些热键也必须处于活动状态。
我能够注册一个热键,这是有效的,即使没有关注应用程序。
但是现在我的问题是,其中一个热键必须处理数据库上的一些东西,进行一些数学计算,然后将结果粘贴到焦点所在的位置,如强制ctrl + c和ctrl + v。
它是简单的数据库和数学部分,但我怎么把东西放在内存中并强制过去的焦点?
任何想法?
很多话
Ray
我尝试过的事情:
我不尝试吃任何东西,我不知道如何开始这部分问题。
Hi,
I'm must solve one problem here in my work, they need a several of hotkeys and each hotkey must do one specific task. This hotkeys must be active even when the application was without focus.
I was able to register a hotkey, this is working, even without the focus on the application.
But now my problem is, one of the hotkeys must process some things on the database, make some math and than paste the result wherever the focus is, like forcing a ctrl+c and ctrl+v.
It's easy the database and math part, but how do I put something in memory and force a past wherever the is focus ?
Any ideas?
Tks a lot
Ray
What I have tried:
I don't try anything eat, I have no idea how to start this part of the problem.
我用这个来解决问题:
Hi,
I solve the problem using this:
using System.Windows.Forms;
// Clear the Windows ClipBoard
Clipboard.Clear();
// Input text on the Windows ClipBoard
Clipboard.SetText(text);
// Paste text wherever the focus were
SendKeys.Send("^v");
Tks
Tks
HI,
您可以查看以下内容:
https://stackoverflow.com/questions/15413172/capture-a-keyboard-keypress-in-the-background
希望有所帮助
You can check the following :
https://stackoverflow.com/questions/15413172/capture-a-keyboard-keypress-in-the-background
Hope it helps
从中获取所选文本其他进程 - C#/ C Sharp [ ^ ]