If you're trying to determine if the keyboard is idle. You could interface to the GetLastInputInfo function using Win32:API. This returns a LASTINPUTINFO structure that contains the tick count since the last input event. The difference between this value and the actual tick count since system boot will give the milliseconds since last input. For example: -
use strict; use Win32::API; my $tc = Win32::GetTickCount(); Win32::API::Struct->typedef( LASTINPUTINFO => qw{ UINT cbSize; DWORD dwTime; } ); Win32::API->Import("user32", 'BOOL GetLastInputInfo(LPLASTINPUTINFO pl +ii)'); my $li = Win32::API::Struct->new('LASTINPUTINFO'); $li->{cbSize} = $li->sizeof; # MSDN: Must be set to sizeof(LASTINPUTIN +FO) GetLastInputInfo($li); print $li->{dwTime} - $tc, "\n";

In reply to Re: windows events by bsdz
in thread windows events by llee

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.