1. RE: Bring window to front

> -----Original Message-----
> From: Thomas Parslow (PatRat) [mailto:patrat at rat-software.com]

> 
> Hi,
> Anyone know of a good way to bring a win32lib window to the 
> front (this is when
> another application has focus)? setFocus doesn't seem to work, I guess
> I could use SetWindowPos to make the window HWND_TOPMOST then set it
> back normal, but that's a bit messy...

Your best bet is probably SetForeGroundWindow, in user32.dll.  From
win32.hlp:

BOOL SetForegroundWindow(
    HWND  hwnd 	// handle of window to bring to foreground
   );

Remarks

The foreground window is the window at the top of the Z order. It is the
window that the user is working with. The system assigns a slightly higher
priority to the thread that created the foreground window than it does to
other threads. 
SetForegroundWindow activates a window and forces the thread that created
the window into the foreground. 
An application should call SetForegroundWindow if it wants to put itself
into the foreground. A good example is a debugger when it hits a breakpoint.


Unlike SetForegroundWindow, the SetActiveWindow function activates a window,
but it only brings the window to the foreground if the window is owned by
the thread making the SetActiveWindow call. 

Matt Lewis

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu