Ctrlユーザーが+を押したことを検出する必要がありますがV(ウィンドウのフォーカスに関係なく、アプリは最小化される可能性があります)、実際の貼り付け操作を停止してはなりません。
私はいくつかのことを試しました:(RegisterHotKeyでキーストロークに正常にバインドしています)
私は持っている:
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x312)
hotKey();
base.WndProc(ref m);
}
そして、私は次のことを試しました:
void hotKey()
{
SendKeys.SendWait("^v"); //just puts 'v' instead of clipboard contents
}
と
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 which makes the app think the user wants
* to save.
*/
}
現在、私が持っている唯一の有効な解決策は、Ctrl+Bなどの別のものにバインドしてから呼び出すSendKeys.SendWait("^v");ことですが、これは理想的ではありません。
理想的な解決策は、ウィンドウが最初にキーストロークを傍受せず、反応した場合です。