Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: Re: "Always on top" with Win32 and Tk

by kevin_i_orourke (Friar)
on May 10, 2001 at 17:43 UTC ( [id://79395]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: "Always on top" with Win32 and Tk
in thread "Always on top" with Win32 and Tk

I tried the VB code, converted to Perl and using Win32::API. (the code isn't the tidiest in the world, I've missed out most of the program):

... use Tk; use Win32::API; # Windows constants my ($OnTop, $NoTop, $Top) = (-1, -2, 0); my ($SWP_NOMOVE, $SWP_NOSIZE) = (2, 1); ... # Create a Win32::API object for SetWindowPos my $SetWindowPos = new Win32::API("user32", "SetWindowPos", [N,N,N,N,N +,N,N], N); ... my $w = new MainWindow; ... # do the 'always on top' bit my $hwnd = $w->frame; # frame returns a hex value as a string, e.g. "0 +x1234" print "$hwnd\n"; $SetWindowPos->Call(hex($hwnd), $OnTop, 0, 0, 0, 0, $SWP_NOMOVE | $SWP +_NOSIZE); MainLoop;

Unfortunately $w->frame returns the Tk MainWindow, not the Win32 window containing it. As a result setting $w->frame 'always on top' doesn't have any effect.

Anyone know how to get an HWND for a window's parent out of Win32? Tk::Wm's $w->wrapper doesn't work either.

--
Kevin O'Rourke

Replies are listed 'Best First'.
Re^4: "Always on top" with Win32 and Tk
by bart (Canon) on Dec 08, 2005 at 00:52 UTC
    Anyone know how to get an HWND for a window's parent out of Win32?
    Try the GetParent API call.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://79395]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found