Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. "Always on top" attribute...

"Always on top" attribute...

Scheduled Pinned Locked Moved The Lounge
announcementquestion
29 Posts 17 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E englebart

    [Original] Some of those window attributes could be tied into the window class which would make it immutable, but I have seen apps that allow it to be toggled. On a hunch, I googled if there is a system hot key for this and some post mentions Ctrl + Spacebar as a toggle. Which is an oft used hot key in my IDEs. I will have to try it later. [Update follows] It looks like window class was for old 32 bit API from another poster. Different poster has/had good good info on SetWindowPos(ition) API which is newer from Vista+. I think the hot key was app specific, I could not get it to work with Notepad. (Notepad could still be win32?) I put a newer post at the bottom with a better reference.

    P Offline
    P Offline
    Paul Sanders the other one
    wrote on last edited by
    #15

    > Some of those window attributes could be tied into the window class There is no such [window class style](https://learn.microsoft.com/en-us/windows/win32/winmsg/window-class-styles). You do it via [SetWindowPos](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos) (by setting `hWndInsertAfter` to `HWND_TOPMOST`). You

    Paul Sanders. If I had more time, I would have written a shorter letter - Blaise Pascal. Some of my best work is in the undo buffer.

    1 Reply Last reply
    0
    • D dandy72

      Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

      M Offline
      M Offline
      MikeCO10
      wrote on last edited by
      #16

      I can't say I've seen any apps that force the always on top lately, with the possible exception of some splash screens on opening. I'm thinking I've seen that with a couple opening from "show hidden icons" menu on the task bar. But they don't maintain it once they load. Some errant App code could set it or something wonky in a focus/modal call in an older program? Back in the day I used "always on top" a couple of times, but it usually turned out to be a nightmare. It's like setting the "unintended consequences" attribute :laugh:

      1 Reply Last reply
      0
      • D dandy72

        Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

        D Offline
        D Offline
        darktrick544
        wrote on last edited by
        #17

        In a couple little utility apps I've made, I have a menu selection for this. When I do offer that option, I also offer one to make the window transparent when not top in the z-order, and a transparency percent. So even though it could be stay on top, you can still see thru it. It has it's uses.

        1 Reply Last reply
        0
        • D dandy72

          Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #18

          I have a feeling this is not a bug in the topmost window handling in the application, but in Windows' management of which application it decides is the foreground app. There have been numerous changes to the foreground decision logic during Windows 7, 10, and 11. Some of the changes were hailed by Microsoft that they gave the user more control, and disallowed applications from the annoying tendency of grabbing the foreground. I also have the feeling some of these changes have been 'internal' in order to handle task bar notification balloons and such. There are also problems with legacy API's (for example, some message box options) that assume foreground behaviors that are no longer certain. TL;DR - It's complicated, from some perspectives it's broke, and they ain't gonna fix it.

          Software Zen: delete this;

          D 1 Reply Last reply
          0
          • L Lost User

            I have apps that run for weeks and have never seen that occur.

            D Offline
            D Offline
            dandy72
            wrote on last edited by
            #19

            For sure. There's no reason whatsoever an app should suddenly start doing this no matter how long it's been running for.

            1 Reply Last reply
            0
            • D dandy72

              Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

              D Offline
              D Offline
              decaffeinatedMonkey
              wrote on last edited by
              #20

              Windows PowerToys has a feature to toggle any app to become top-most. It would be cool for that feature to notify you which apps are already top-most, and flip that switch off if they try to force being top-most.

              D M 2 Replies Last reply
              0
              • G Gary Wheeler

                I have a feeling this is not a bug in the topmost window handling in the application, but in Windows' management of which application it decides is the foreground app. There have been numerous changes to the foreground decision logic during Windows 7, 10, and 11. Some of the changes were hailed by Microsoft that they gave the user more control, and disallowed applications from the annoying tendency of grabbing the foreground. I also have the feeling some of these changes have been 'internal' in order to handle task bar notification balloons and such. There are also problems with legacy API's (for example, some message box options) that assume foreground behaviors that are no longer certain. TL;DR - It's complicated, from some perspectives it's broke, and they ain't gonna fix it.

                Software Zen: delete this;

                D Offline
                D Offline
                dandy72
                wrote on last edited by
                #21

                This is the closest thing to a possible explanation as I've seen throughout this entire thread; seems like some people have missed my point, or intentionally ignored it.

                Gary Wheeler wrote:

                TL;DR - It's complicated, from some perspectives it's broke, and they ain't gonna fix it.

                No feature is ever so simple that MS can't find a way to complicate it to the point where it becomes buggy.

                1 Reply Last reply
                0
                • D decaffeinatedMonkey

                  Windows PowerToys has a feature to toggle any app to become top-most. It would be cool for that feature to notify you which apps are already top-most, and flip that switch off if they try to force being top-most.

                  D Offline
                  D Offline
                  dandy72
                  wrote on last edited by
                  #22

                  That's an intriguing idea. If it was such a big hassle, I just might throw something together to periodically pool all windows and look which has the attribute, and log when the topmost flag gets assigned to a window - that might help narrow down what actually triggers it. But, it's still so rare I don't think I'd invest the time in doing that. Every time I've seen this happen, closing/restarting the app is all that's needed to get the window behaving normally again, and I can certainly live with that.

                  1 Reply Last reply
                  0
                  • D decaffeinatedMonkey

                    Windows PowerToys has a feature to toggle any app to become top-most. It would be cool for that feature to notify you which apps are already top-most, and flip that switch off if they try to force being top-most.

                    M Offline
                    M Offline
                    maze3
                    wrote on last edited by
                    #23

                    POWER TOOLS 💪 POWER, FLEX came to say same. And Media Player Classic has 3 options, for all the uhm "home movies" I watch. 😶 always on top on top while playing 👍 off

                    1 Reply Last reply
                    0
                    • D dandy72

                      Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

                      B Offline
                      B Offline
                      Bruce Patin
                      wrote on last edited by
                      #24

                      No, I have not seen windows forcibly moved underneath an "always on top" window, but I have often waited for some function in an app to be done with a spinning GIF indicating that it is working on the task, then several minutes later, maybe after I have given up and aborted the operation, find that there was a required dialog to continue that process underneath the main window that I was waiting on. That's one case where such dialogs should be "always on top", so I don't miss them.

                      D 1 Reply Last reply
                      0
                      • D dandy72

                        Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

                        M Offline
                        M Offline
                        Matthew Barnett
                        wrote on last edited by
                        #25

                        I've recently started using "EPG Centre", an app that reads the EPG that's broadcast by Freeview. Its progress bar is always on top. It takes several minutes to read the EPG, so I start it and then let it run in the background, but the progress bar stays on top, for no reason.

                        D 1 Reply Last reply
                        0
                        • B Bruce Patin

                          No, I have not seen windows forcibly moved underneath an "always on top" window, but I have often waited for some function in an app to be done with a spinning GIF indicating that it is working on the task, then several minutes later, maybe after I have given up and aborted the operation, find that there was a required dialog to continue that process underneath the main window that I was waiting on. That's one case where such dialogs should be "always on top", so I don't miss them.

                          D Offline
                          D Offline
                          dandy72
                          wrote on last edited by
                          #26

                          MessageBox.Show( "blah" );

                          ...with no parent param specified will often result in that sort of thing. If you've switched to another app before the popup appears, giving focus back to the app will NOT bring the popup back from behind whatever it's hiding. Set your message box parents, people!!

                          1 Reply Last reply
                          0
                          • M Matthew Barnett

                            I've recently started using "EPG Centre", an app that reads the EPG that's broadcast by Freeview. Its progress bar is always on top. It takes several minutes to read the EPG, so I start it and then let it run in the background, but the progress bar stays on top, for no reason.

                            D Offline
                            D Offline
                            dandy72
                            wrote on last edited by
                            #27

                            Sounds like in this case, it was intentionally designed this way. Clearly these guys think they're so important the progress bar must *always* remain visible...

                            1 Reply Last reply
                            0
                            • D dandy72

                              Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

                              E Offline
                              E Offline
                              englebart
                              wrote on last edited by
                              #28

                              I found this on another site that seems to line up with what you are seeing, especially if you use the WinLogo + D, or task bar "Show the desktop" to toggle all windows away, then back. There are some possible work arounds mentioned like Ctrl+Alt+Esc might help reset it. [https://superuser.com/questions/269415/show-desktop-sometimes-sets-a-window-to-always-on-top\](https://superuser.com/questions/269415/show-desktop-sometimes-sets-a-window-to-always-on-top)

                              1 Reply Last reply
                              0
                              • D dandy72

                                Decades ago MS added an "always on top" attribute you could give to a window your app creates so you could have a window that was always floating on top of everything else. If you dragged another window over that area, you could see the window being dragged slide "underneath" it rather than on top of it as you would otherwise ordinarily expect. These days you rarely see apps using this attribute, but I don't believe there's anything in more recent versions of Windows to prevent you from using it. For the past couple of years (and it's been this long before I decided to ask, just now) I've noticed a few apps that should never have this attribute, or at least have never presented any option to make it top-most, seemingly *randomly* get this attribute out of nowhere, and it stays that way until you close the app and restart it. I have an old version of a news reader (as in Usenet) that does this every once in a while, and I've also seen remote desktop sessions do it also. Once the window somehow decides it's going to always be on top, I can't bring other windows in front. None of the apps I've seen exhibit this behavior have any option to turn this on or off, and I can't imagine any sort of criteria where code in an app might turn on the always-on-top attribute. Am I speaking total non-sense, or has anyone else ever seen this? [Edit] I've done a quick google search, and while there are apps that apparently people use to make any app top-most, I absolutely, positively, have never downloaded such apps...and as far as I know there's no magic, secret key combination built into Windows to do that either.

                                S Offline
                                S Offline
                                Shmoken99
                                wrote on last edited by
                                #29

                                Managed code or unmanaged code? Could a memory leak or uninitialized pointer flip the always on top setting for a long running app? Even managed code can be leaky, but usually you just run out of memory.

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups