how to perform a hold ALT+TAB sendkey event in C#

前端 未结 4 590
悲哀的现实
悲哀的现实 2021-01-13 11:43

I am trying to use a sendkey event that holds the ALT key and then presses the TAB key. How do you perform that action, I\'ve tried many variations but I can\'t seem to find

相关标签:
4条回答
  • 2021-01-13 12:18

    After going through the MSDN documentation page I came up with this and it seems to be working just fine for me:

    SendKeys.Send("%{Tab}");

    0 讨论(0)
  • 2021-01-13 12:25

    [Windows.Forms.Sendkeys]::SendWait("%{Alt Down}")

    [Windows.Forms.Sendkeys]::SendWait("%{TAB}")

    [Windows.Forms.Sendkeys]::SendWait("%{Alt Up}")

    Works in Powershell for me! Thanks for tips ;)

    0 讨论(0)
  • 2021-01-13 12:30

    Using sendkeys PInvoke it's possible to do this by sending ALT keydown event, TAB keydown, then TAB keyup, then ALT keyup. There is also another way using the ALT modifier on the key but I cannot remember exactly how as I haven't worked with it in a while.

    If you want to do multiple tabs alternate the TAB keydown and keyup while keeping the ALT on keydown.

    0 讨论(0)
  • 2021-01-13 12:32

    Its quite simple:

    SendKeys.SendWait("%({tab})");
    
    0 讨论(0)
提交回复
热议问题