Search code examples
c#tabskeyboardsendkeys

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


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 the answer, thanks.


Solution

  • 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.