[Mono-list] Portably getting the keyboard state in Windows.Forms?

Mark Gimelfarb mark@dawebber.com
Fri, 11 Jun 2004 22:55:46 -0500


How about implementing an IMEssageFilter and listening to WM_KEY events?
I know it's a lot of work, but might be the most probable way to do this cross-
platform.

Regards,
        Mark.


Quoting Stuart Ballard <sballard@netreach.com>:

> I'm writing a simple WinForms based game, and obviously using normal 
> keydown/keyup/keypress listeners has some limitations in that scenario 
> (because you want to be able to be aware that several non-modifier keys 
> are pressed at once, eg both "up" *and* "left").
> 
> An article at http://www.syncfusion.com/FAQ/WinForms/FAQ_c46c.asp 
> appears to answer this question partially, but the answer is to use 
> P/Invoke of the GetKeyState function which is obviously not portable to 
> Mono (from reading around a little bit, it sounds like I might want 
> GetAsyncKeyState instead, but the same problem applies, of course).
> 
> Is there a way to do this on Mono's WinForms at all? If so, is it 
> portable to the MS .NET framework too?
> 
> Thanks,
> Stuart.
> 
> -- 
> Stuart Ballard, Senior Web Developer
> NetReach, Inc.
> (215) 283-2300, ext. 126
> http://www.netreach.com/
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>