Search code examples
c#keyboard-shortcuts

How to catch Alt-Tab and such in C#?


A friend is trying to write something not entirely unlike the old wintutor.exe from the olden days of Windows 3.1. It's meant to show some complete newbs the ropes of using WinXP, and the tutorial needs to respond to Alt + Tab and such for their own protection. How do you do this in C# Winforms?


Solution

  • I have no first-hand experience doing this and I don't know if there's an easier way now, but this CodeProject article discusses using C# to tap low-level Windows APIs that will trap keyboard strokes like Alt + Tab.