Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Console keyboard hook not getting called

$
0
0

I am trying to install a keyboard hook to trap key down/up events in a console app.  I started with this example:

http://blogs.msdn.com/b/toub/archive/2006/05/03/589423.aspx

The code compiles, loads, and the hook appears to install fine (all functions return expected values, no failures, etc.) however my hook function is never called.

My hook code is in a DLL that is loaded by the application that also opens the console window, and within my DLL methods I can use Console.WriteLine() and have the text output correctly to the console.  I can also successfully use PostMessage() to inject messages back to the console, so everything is working except the hook.

How can I figure out what is happening here and why my hook function is not being called?

Thanks,

Matthew


Viewing all articles
Browse latest Browse all 31927

Trending Articles