Search code examples
c#winformshook.net-6.0keyhook

C# Global hook Keyboard, Winform - .NET 6.0


I have a question about a problem I haven't been able to solve in the past couple hours. So basically I want to make a C# WinForm app in .NET 6, and I need the app to respond to the ctrl key being pressed (It would simulate what a click of a certain button would do), but there is a catch. I need the app to sense a key pressed while being minimized. When the app is in normal state it is working, but not when minimized. A lot of other answers here were old, so I wanted to make my own, since none of the solutions worked for me, and the code was quite complicated. Thank you for any responses.


Solution

  • Link to the aswer I found that worked for me.