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

Stuart Ballard sballard@netreach.com
Fri, 11 Jun 2004 08:25:38 -0400


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/