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

Iain McCoy iain@mccoy.id.au
Sat, 12 Jun 2004 16:03:56 +1000


On Fri, 2004-06-11 at 22:25, Stuart Ballard wrote:
> 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?
Don't quote me on this, but if I understand the way winforms is being
done at all you should be able to p/invoke out to win32 functions and
have the wine implementation of said functions kick in, so it should all
Just Work if wine implements the functions you need.
-- 
Iain McCoy <iain@mccoy.id.au>