如何preSS Windows按钮编程方式使用C#的SendKeys
基本上我想在$ C $模拟C对Windows按钮用户点击。我知道有一个的SendKeys,让我送钥匙presses到Windows,如果我得到一个处理他们,但我想不出是我需要得到以发送的Windows按钮命令的处理。例如。 windows键+ L。看了这个有点看来,CTRL-ESC应弹出开始菜单也但不知道如何告诉它的按键发送到Windows(如果这甚至有可能)。任何帮助将是非常美联社preciated。
Basically I want to simulate in code a user clicking on the windows button. I know there is SendKeys which allows me to send key presses to windows if I get a handle to them, but what I can't figure out is what I need to get a handle on in order to send Windows button commands. E.g. Windows Button + L. Having read into this a bit it appears that CTRL-ESC should pop up the Start Menu also but not sure how to tell it to send the keys to Windows (if this is even possible). Any help would be much appreciated.
干杯!
我不认为你可以做到这一点使用的SendKeys,您将需要的P / Invoke给API函数来代替,大概的 keybd_event 来发送CTRL + ESC或Windows键。
I don't think you can do this using SendKeys, you will need to p/invoke to an API function instead, probably keybd_event to send either CTRL+ESC or the Windows key.
这里是打开开始菜单中的一个例子在VB方式这里是keybd_event上的PInvoke它的C#签名。净。
Here is an example of opening the start menu this way in VB and here is keybd_event with its C# signature on pinvoke.net.