Try this:

------------------------
use Win32::Console;
$con = Win32::Console->new(STD_INPUT_HANDLE);
@event = $con->Input();

print "$event[0] - event type: 1 for keyboard\n";
print "$event[1] - key down: TRUE if the key is being pressed, FALSE if the
key is being released\n";
print "$event[2] - repeat count: the number of times the key is being held
down\n";
print "$event[3] - virtual keycode: the virtual key code of the key\n";
print "$event[4] - virtual scancode: the virtual scan code of the key\n";
print "$event[5] - char: the ASCII code of the character (if the key is a
character key, 0 otherwise)\n";
print "$event[6] - control key state: the state of the control keys (SHIFTs,
CTRLs, ALTs, etc.)\n";
------------------------

You want $event[5].

Herb Hall

----- Original Message -----
From: "Nathaniel Wert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 12, 2001 12:11 PM
Subject: win32 console input problem


> Here's the code:
>
> use Win32::Console;
> $con = Win32::Console->new(STD_INPUT_HANDLE);
> @event = $con->Input();
> $tmp = $event[6];
> print "\n The character typed was: $tmp \n";
>
> For some reason $event[6] is always returning the
> ascii value of the space character no matter what I
> type.  I am not really sure why.
>
> Thank ahead of time for the help.
>
> __________________________________________________
> Do You Yahoo!?
> Check out Yahoo! Shopping and Yahoo! Auctions for all of
> your unique holiday gifts! Buy at http://shopping.yahoo.com
> or bid at http://auctions.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to