> -----Original Message----- > From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl- > win32-users-boun...@listserv.activestate.com] On Behalf Of Barry Brevik > Sent: 01 September 2011 17:33 > To: perl-win32-users@listserv.ActiveState.com > Subject: Keyboard handler > > This is a bit of a selfish post, but since list traffic is low right > now, here goes. > > I'm developing a routine that essentially loops looking for keyboard > input. If it has any, it processes the key otherwise it performs some > other (short) processes and loops around again to check for keyboard > input. > > I've been writing a routine that uses Win32::Console in the manner > shown > below. > > Anyway, writing this has become way complex, and I've lost my way. I'm > wondering if anyone out there has some example code that they would be > willing to share? > > Barry Brevik > ================================================= > my $STDIN = new Win32::Console(STD_INPUT_HANDLE); > $STDIN->Mode(ENABLE_PROCESSED_INPUT); > > while (1) > { > # Read keyboard event. > my @input = $STDIN->Input(); > if (defined $input[0] and $input[0] == 1) > { > <key processing happens> > } > > <now other processing happens> > }
Not sure what you mean. That code doesn't see very complex. In case you haven't spotted them, there are a few FAQs that may help. See 'perldoc -q key' to start with. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs