Screen Size

R

Rich

Does anyone know how to get the screen size of the client using
straight Perl (no javascript)? I have seen several posts which use
"ioctl.ph" but I have been unable to locate this file. I tried
downloading the source code to perl but was only able to find
ioctl.pl.
 
A

A. Sinan Unur

(e-mail address removed) (Rich) wrote in @posting.google.com:
Does anyone know how to get the screen size of the client using
straight Perl (no javascript)? I have seen several posts which use
"ioctl.ph" but I have been unable to locate this file. I tried
downloading the source code to perl but was only able to find
ioctl.pl.

Let's see. You want a program running on a computer to somehow know the
display settings of a computer running the browser. If this does not strike
you as odd then you probably have no business programming.

You could ask the user and remember the user's pereference using a cookie,
but none of this is really Perl specific.
 
W

Wayne

(e-mail address removed) (Rich) wrote in @posting.google.com:
Does anyone know how to get the screen size of the client using
straight Perl (no javascript)? I have seen several posts which use
"ioctl.ph" but I have been unable to locate this file. I tried
downloading the source code to perl but was only able to find
ioctl.pl.

Try:
....
use Win32::Console;
....
my ($cons, $col, $row, $ncols, $nrows, $ic, $oc, @ci,
$size, $visible);
....
$cons = Win32::Console->new(STD_ERROR_HANDLE);
die "Cannot attach to console!\n" if ( ! $cons );
....
# get the screen width from the Info call
@ci = $cons->Info();
$ncols = $ci[0] ? $ci[0] : 1; # when STDERR is redirected, it
returns 0
$nrows = $ci[10] ? $ci[10] : 1; # when STDERR is redirected, it
returns 0
#$nrows -= 1;
....
print STDERR "MAX x=$ncols, y=$nrows\n";
....

- Mr. Software
 
J

Joe Smith

Rich said:
Does anyone know how to get the screen size of the client using
straight Perl (no javascript)?

If the program is running on your PC, perl can determine the
size of the command-line window being used on your PC.

If the program is running as a service on a server, it can get the size
of the client's command-line window if the protocol being used supports it.
Both TELNET and SSH protocols do, but HTTP does not.

If the client is a web browser, it cannot be done in straight perl.
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,114
Latest member
GlucoPremiumReview
Top