I am building a Perl-based application under Win32 (say, Windows 7/8/10) where I need to monitor what's going on in a particular region of the desktop display.

However, the region to be monitored is generated by another application and its output can be of a variable size and a variable location on the display, although it will always be a rectangular region within a standard window (but that Window can be of variable size).

So, I'm intending to have some mechanism where I can use a rectangular selection area/fence (much how the Windows 'Snipping Tool' works) to define an area of interest on the desktop. However, what I want returned from the selected area is not the content (as the Snipping Tool provides) but more the rectangular region's position/dimension information; I envisage this information to be presented like it is often specified in X11-parlance, as a "WxH+x+Y" string.

There is a tool I use under Windows called Meazure (see https://www.cthing.com/Meazure.asp) which captures the information I want but I can't retrieve the info very easily from that tool.

Hence, I'm looking to see if there's a Perl-ish way I can do what I need... If I'm lucky, there might be a CLI tool to do what I'm describing (I found one of those for Linux/X11/C (see https://bbs.archlinux.org/viewtopic.php?id=85378) but couldn't find anything similar for Windows... so far(!)).

Maybe something can be done with a Perl/Tk canvas that has a transparent background (is that even possible?) or something? Hmm... much work in that approach, I fear...

Anyway, I'd appreciate any thoughts.

Using Windows7-32bit/SP1 and Windows8-32bit, ActiveState Perl v5.16.3 and v5.20.2.


John

Edit: Updated with the version of Perl I use at home (v5.20.2)

In reply to How Do I Select An Area of the Win32 Desktop and Return Its Size and Location? by ozboomer

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.