What are you trying to achieve? Most often a window will have a frame of some type appropriate to the window. Generally if you want a window that looks and behaves differently to standard windows you need to sub-class a standard window.
Perl is Huffman encoded by design.
| [reply] |
I am trying to write something like WinSpy in Perl - for the exercise and the learning mostly. When their cursor icon is moved over windows it outlines the window under the cursor.
| [reply] |
In that case you need to get a DC for the descktop and draw to that.
Yell if you need more help. I may be able to provide a little, but I can't take you all the way there. (I know Win32 API somewhat, but haven't driven it from Perl).
Perl is Huffman encoded by design.
| [reply] |
This is a long way shy of perfect, but it might help.
#! perl -slw
use strict;
use Win32::API;
use Win32::GuiTest qw[:ALL];
use Win32::GUI;
Win32::API->Import(
'user32',
'BOOL InvalidateRect( HWND hWnd, VOID, BOOL bErase )'
) or die $^E;
my $hdc = new Win32::GUI::DC("DISPLAY") or die $^E;
my $pen = new Win32::GUI::Pen( -style => 0, -width => 1, -color => [ 2
+55, 0, 0 ] );
$hdc->SelectObject( $pen );
$hdc->BkMode( 1 );
my $oldHwnd;
while( my( $x, $y ) = GetCursorPos() ) {
last unless $x or $y;
my $hwnd = WindowFromPoint( $x, $y );
Win32::Sleep 10 and next if $hwnd == $oldHwnd;
InvalidateRect( $oldHwnd, 0, 1 );
SendMessage( $oldHwnd, 0x0128, 0, 0 ) if $oldHwnd;
my( $l, $t, $r, $b ) = GetWindowRect( $hwnd );
print "$hwnd: $hdc ($x, $y) : ( $l, $t, $r, $b )";
$hdc->MoveTo( $l, $t );
$hdc->LineTo( $r, $t );
$hdc->LineTo( $r, $b );
$hdc->LineTo( $l, $b );
$hdc->LineTo( $l, $t );
$oldHwnd = $hwnd;
}
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
| [reply] [d/l] |