Hi, I'm trying to write a Win32 app that prompts for a 3 character input and stores it in a variable for later use. However, so far I've got it to spawn a new console, write my text to the console, and then it doesn't seem to be waiting for input. My Perl in a Nutshell book indicates the ReadChar call from Win32::Console should be able to read a certain number of characters from the console, but it doesn't seem to be pausing for this input. Below is the code. All advice appreciated.
Thanks,
Glenn
#!/usr/bin/perl
use Win32::Console;
$con = Win32::Console->new();
$con->Mode(ENABLE_WINDOW_INPUT,ENABLE_PROCESSED_INPUT,ENABLE_LINE_INPU
+T,ENABLE_ECHO_INPUT,ENABLE_PROCESSED_OUTPUT,ENABLE_WRAP_AT_EOL_OUTPUT
+);
$con->Display;
$con->Write("Please enter the agent ID number: "); # I want to wait fo
+r input here, but apparently the ReadChar below doesn't do that
@info = $con->Info();
$con->Write("The cursor info is ",$info[3],",",$info[4],". \r"); # Thi
+s presently prints no cursor data
$port = ($con->ReadChar(3,$info[3],$info[4]));
$con->Write("The port number to use is ",$port);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.