English 中文(简体)
C# Programmatical sent two keys when You are established another one
原标题:C# Programmatically send two keys when you are already pressing another one
  • 时间:2011-11-21 18:10:57
  •  标签:
  • c#

我把我自己掌握的多份纸面复印件/剪辑工具放在了背景之下,我最后实现了这一工具。

这是它如何运作,

  • when Capslock it s pressed, if I press CTRL+1 I make a CTRL+C programmatically ( with SendKeys) and save the clipboard on my list with correct position
  • when capslock it s not pressed, if I press CTRL+1 I make a CTRL+V programmatically ( with send keys) by using the latest data in clipboard on the correct list position.

现在,这是很不错的,但我想作一点改动,但我不想使用锁定,但我要像ALT或SHIFT那样,再打另一个钥匙,但如果你保持一个不是CTRL的关键,然后是CTRL+C,那么它就不起作用。

没有人对这一 d事提出任何建议?

感谢gu

问题回答

If you don t mind using WinApi functions, you can use RegisterHotKey and UnregisterHotKey functions. They allow you to register and unregister global shortcuts of your choice. This way you ll get notified about a shortcut being pressed even if your application is running in background and doesn t have the focus on itself.

http://www.pinvoke.net/default.aspx/user32/RegisterHotKey.html“rel=“nofollow”>here和here。 甚至有一些样本应用代码,以便你能够看到如何使用这些文本。

<>光> 请各位在申请撤销后登记的所有短官。

你们可以用旗帜来选择钥匙。 当你检查什么关键人物时:

象以下伪装法典这样的东西应当做到:

if(select key)
{
  this.selectKey = true;
}
else
{
  if(ctrl key)
    {
        //do whatever you would normally do here
    }
   this.selectKey = false;
}




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签