English 中文(简体)
利用SendKeys 发送Windows钥匙
原标题:Sending Windows key using SendKeys

我在C#中就捷尔、阿尔特和斯德凯尔等地开展了简短的工作。

与此类似;

Ctrl+C:

System.Windows.Forms.SendKeys.SendWait("^c");

Alt +F4:

System.Windows.Forms.SendKeys.SendWait("%{F4}");

但是,我可以向SendKeys发送“Windows Key”。 我曾尝试过:Win+ E:.SendWait("#e”>,但并未奏效。 我应该用什么而不是“先”?

感谢。

最佳回答

OK turns out what you really want is this: http://inputsimulator.codeplex.com/

谁在将<条码>上载录方法到C#中做了所有辛勤工作。 这使你能够直接发送钥匙。 测试和工作:

InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_E);

但是,在某些情况下,你希望具体发送申请的钥匙(例如),在这种情况下使用<代码>Form的图书馆方法。 在另一些情况下,你希望向一般的监督厅发送,使用上述信息。


www.un.org/spanish/ecosoc 年限

不要在此提及这一点,它不会在所有业务系统中工作,也不会总是想像你。 请注意,你再次试图将这些关键电线送至电线,而本组织通常在早期就拦截这些电线。 就Windows 7和Vista而言,时间过早(发送 E)。

SendWait("^({ESC}E)") or Send("^({ESC}E)")

注:

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".

请注意,由于您希望同时发布<代码>ESC和(say) E,你需要将其放在括号内。

问题回答

https://www.nuget.org/ Packages/InputSimulator/“rel=“noreferer”>nuget Pack/a。

然后写:

        var simu = new InputSimulator();
        simu.Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_E);

in my case to create new vertial desktop, 3 keys needed and code like this(windows key + ctrl + D):

        simu.Keyboard.ModifiedKeyStroke(new[] { VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL }, VirtualKeyCode.VK_D);

Alt+F4只在括号中发挥作用。

SendKeys.SendWait("(%{F4})");
SetForegroundWindow( /* window to gain focus */ );
SendKeys.SendWait("^{ESC}"); // ^{ESC} is code for ctrl + esc which mimics the windows key.

Ctrl+Alt+Right => use this ==>“(>%({})”





相关问题
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. ...

热门标签