bugfixr
bugfixr

Reputation: 8077

Intercept WindowsKey + L (Lock) keypress in C#?

Is it possible to intercept the WindowsKey + L (The short cut to lock the console) from a running application?

I've got an app that needs to catch that and display a custom window for about 5 seconds, then allow the lock to go through.

Can I do this in natively in c#? If not, can I do this with some sort of Windows API?

Thanks in advance

Upvotes: 1

Views: 1150

Answers (1)

majocha
majocha

Reputation: 1191

It's definitely doable, but I'm afraid you need to pinvoke:

SetWindowsHookEx

LowLevelKeyboardProc

GetAsyncKeyState could be relevant, too

Upvotes: 1

Related Questions