开发者

Windows API: handling keypress event of external window application through C#

I have one external application window opened. Through my winform application, i want to execute certain code when keypress event happens on this external window.

I know window handle of this external application window.

Any help will be truely appreciated.

开发者_如何学Go

Thanks,


One way to do this is to set up a hook on the external application window with SetWindowHookEx. Then monitor the WM_KEYDOWN message.

I am actually not sure that it will work in C# because the hook callback has to be in a native DLL. You might have to write a portion of the solution in an unmanaged language.

Alternatively, you could use a global keyboard hook, possibly combined with a check of the currently active window.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜