我需要检测用户何时按下Ctrl+ V(无论窗口焦点如何 - 我的应用程序可能会被最小化)但我不能停止实际的粘贴操作.
我尝试了一些事情:(我成功绑定了RegisterHotKey的键击)
我有:
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x312)
hotKey();
base.WndProc(ref m);
}
Run Code Online (Sandbox Code Playgroud)
我尝试过以下方法:
void hotKey()
{
SendKeys.SendWait("^v"); //just puts 'v' instead of clipboard contents
}
Run Code Online (Sandbox Code Playgroud)
和
void hotKey()
{
SendKeys.SendWait(ClipBoard.GetText());
/* This works, but since Ctrl is still down, it triggers
* all the shortcut keys for the app, e.g. if the keyboard
* contains 's' then instead of putting 's' in the app, it
* calls Ctrl+S …Run Code Online (Sandbox Code Playgroud)