The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Window management in Windows

Hi all....heres a wee problem, how can I ensure that a particular window from my application always remains on top regardless of what other apps are doing?  ..in osx this is surprisingly easy but Im stumped on the windows side...
FullNameRequired
Tuesday, January 11, 2005
 
 
What you want is the SetWindowPos function.

(P.S. Google is your friend...)
Almost Anonymous Send private email
Tuesday, January 11, 2005
 
 
Setting your window to always be "on top" is easy. What is not easy is making sure it gets first grab at the focus. There must be a reason why you need to do this, yes?

Perhaps a Windows hook would do the trick.

Silly Me
Silly Me
Tuesday, January 11, 2005
 
 
I can't remember the specifics, but I recall having a similar task at hand in the past. I think using SetWindowsPos to put your window at top-most does not actually work, as other windows that pop-up thereafter actually end up on top of yours. The only way to ensure you are always top-most is to have a timer that runs SetWindowPos every 3 sec.
Simon@AutoUpdate+
Wednesday, January 12, 2005
 
 
SetWindowPos(my_hwnd, HWND_TOPMOST, ...
Alex Send private email
Wednesday, January 12, 2005
 
 
"how can I ensure that a particular window from my application always remains on top regardless of what other apps are doing?"

I *hate* when programs do this.  The only thing worse is a non-moveable, always-on-top dialog box.
Mark Jerde Send private email
Wednesday, January 12, 2005
 
 
It's called abuse (similar to the tray icon fetish).

But when it's legitimate, it's priceless.
Alex Send private email
Wednesday, January 12, 2005
 
 
I also hate it when apps do this to me. It's nasty and it's modal. There used to be an old t-shirt doing the rounds with the words "Don't mode me in" on it. I'd be wearing it.

http://www.byte.com/art/9608/sec4/art3.htm

Why do you want to do this anyway, is there not another way around what you are trying to achieve? Just trying to be constructive rather than negative.
Gavin Laking Send private email
Wednesday, January 12, 2005
 
 
"Why do you want to do this anyway?"

program displays videos from the desktop, often learning videos, users have requested the option of having them float over the top of everything else.
FullNameRequired
Wednesday, January 12, 2005
 
 
I have lots of always-on-top applications; my TV app, my messanging contact list, etc.  I see nothing wrong with that.  If my word processor was always-on-top, I might be pissed though.

It seems like SetWindowPos is all you need.
Almost Anonymous Send private email
Wednesday, January 12, 2005
 
 
Hey, what happens when two always-on-top apps are competeing for the same screen real estate?  I have no idea, and thought someone here might.
Aaron F Stanton Send private email
Thursday, January 13, 2005
 
 
The windows maintain their z-order the same way as if they weren't always-on-top.  So I click my TV app, it's come in front of my IM app.  If I click my IM app, it goes in front of my TV app -- but they are always on top of every other Windows.
Almost Anonymous Send private email
Thursday, January 13, 2005
 
 
Dare I ask what happens when you decide you have to have another app that is always at the top of the always-on-top apps?
David Clayworth
Thursday, January 13, 2005
 
 
...somewhere in the cubical jungle at 1 Microsoft Way, a lowly engineer's head explodes.
Almost Anonymous Send private email
Thursday, January 13, 2005
 
 
Make sure you make this a user option, not an always-on setting.  Like others, I'm really pissed when apps like this happen.

At my last job we had an app that sent faxes (see the other post on faxing software) and its "progress" window was a stay-on-top.  The app had the bad habit of running away with itself, and it also had to run on the same box as an Outlook client. If we ever had to do anything with the Outlook client (move files, etc.) while this app was sending faxes, it was a nightmare.  We'd highlight the Outlook stuff, then this app would pop to the front and undo the Outlook work.  Ugh!

MAKE IT OPTIONAL!!!!!
Karl Perry Send private email
Friday, January 14, 2005
 
 
Always-on-top-ness isn't nested. It's either on or off, and when on, they follow regular Z rules.
Alexandru Pojoga Send private email
Saturday, January 15, 2005
 
 
No, windows with the TOPMOST state are in a separate 'layer' of windows on top of all normal windows. So, if you have multiple windows that are top-most, you can just click on a window to activate it and get it to the foreground (in front of the other top-most windows). They will always float on top of normal windows though, even when inactive.
Frederik Slijkerman Send private email
Thursday, January 20, 2005
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz