Being a long suffering Windows user, I have developed a mouse habit that I would now like to break, relying more on keyboard shortcuts. But the trouble is that every Windows application introduces yet another set of keyboard shortcuts to remember...

This CUFP hovers above other windows and as you switch between applications it displays a relevant list of shortcut reminders.

use strict; use warnings; use Tk; use Win32::API; # Windows constants my ($ONTOP, $NOTOP, $TOP) = (-1, -2, 0); my ($SWP_NOMOVE, $SWP_NOSIZE) = (2, 1); my $SetWindowPos = new Win32::API("user32", "SetWindowPos", 'NN +NNNNN', 'N'); my $FindWindow = new Win32::API("user32", "FindWindow", 'PP', + 'N'); my $GetForegroundWindow = new Win32::API("user32", "GetForegroundWindo +w",'','N'); my $GetWindowText = new Win32::API("user32", "GetWindowText",'NP +I','I'); my $fg = 0; # foreground hWnd my $flashme = 'Waiting to show shortcut keys'; my $w = new MainWindow; my $fc = $w->Label(-textvariable => \$flashme, -justify => 'left')->pa +ck; my $id = Tk::After->new($w,2000,'repeat',\&showFlashCard); my $flashcards = { 'Microsoft Outlook' => qq{Outlook CTRL-1 - Mail CTRL-2 - Calendar CTRL-4 - Task List CTRL-Y - Go to Folder... CTRL-E - Find... ALT-F1 - Toggle Nav Pane CTRL-SHIFT-V - Move Items to Folder... }, 'SQL Query Analyzer' => qq{Query Analyzer CTRL-D - Results as datagrid CTRL-T - Results as text CTRL-R - Toggle Results Pane CTRL-L - Execution Plan F8 - Toggle Object Browser CTRL-SHIFT-P - Open File }, 'Mozilla Firefox' => qq{Mozilla FireFox CTRL-L - Location CTRL-D - Add Bookmark CTRL-B - Bookmarks } }; # start the UI MainLoop; sub showFlashCard { my $thisfg = $GetForegroundWindow->Call(); if ($fg != $thisfg) { # Foreground Window has changed $fg = $thisfg; my $wt=' 'x150; my $i = $GetWindowText->Call($fg,$wt,150); $wt = substr($wt, 0, $i); #warn "$fg\t$wt\n"; # use this to ascertain window text for my $re (keys %$flashcards) { if ($wt =~ /$re/) { $flashme = $flashcards->{$re}; } } } # Reestablish Z order my $class = "TkTopLevel"; my $topHwnd = $FindWindow->Call($class, $w->title); $topHwnd and $SetWindowPos->Call($topHwnd, $ONTOP, 0, 0, 0, 0, $SW +P_NOMOVE | $SWP_NOSIZE); }

 


In reply to Hovering keyboard shortcut reminders for Win32 apps by EdwardG

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.