[Mono-list] Portably getting the keyboard state in Windows.Forms?
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 - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Portably getting the keyboard state in Windows.Forms?
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 <[EMAIL PROTECTED]>: > 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 - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list > ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Portably getting the keyboard state in Windows.Forms?
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 <[EMAIL PROTECTED]> ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list