As with most things, context is key. If you're trying to read the screen resolution of the reader's computer from a CGI script, you can't do it directly. Since you specified no JavaScript, all that's left to suggest is VBScript or some sort of custom control. CGIs don't magicly have some sort of access to the users' computer that HTML pages don't. All they can do is read the headers and form data sent to them.

If you're using some sort of GUI toolkit to make a program that runs localy, the answer depends on the toolkit. I don't happen to know the answer for any of them, but a search through the documentation of the module in question will probably reval somthing. If you're writing a program designed for win32, try Win32::API, and a search on MSDN for "screen resolution". The search will reveal a page called "C++ Q&A: Stopping Screen Savers, Detecting Screen Resolution, Adding Status Bar Buttons -- MSDN Magazine, December 2001", which will point you at the documentation for GetSystemMetrics, which should be fairly easy to interface to with Win32::API, assuming you have a copy of windows.h handy. (If you don't, reply to this node, and let me know what constants you want. windows.h will be included with any C compiler for win32. Search for it online first, though, because you might be able to a copy.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).


In reply to Re: Resolution by theorbtwo
in thread Detecting web clients monitor resolution without javascript by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.