Results 1 to 12 of 12

Thread: [RESOLVED] How do I find out if a window is Always On Top?

  1. #1

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Resolved [RESOLVED] How do I find out if a window is Always On Top?

    SetWindowPos is used to actually set it as always on top. I want to know if it already is. I'm thinking I need to check its z-order or something, but I don't know how.

  2. #2
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: How do I find out if a window is Always On Top?

    WindowStyle if I'm correct.. GetForegroundWindow and check the hwnd for style properties.

  3. #3

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How do I find out if a window is Always On Top?

    Thanks. I should have thought of that. You still need to use SetWindowPos to actually make it on top (SetWindowLong doesn't work) but you can get/set a flag saying whether it is always on top.

    In case anyone's wondering it is 0x8h.

  4. #4
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    There is one slight bug in it though; Modal windows of Foreground apps might be seen as the most-top window. so make sure you pick the parent if you have modals

  5. #5

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    That's strange, I notice (with Spy++) that a topmost window has 0x8h set for both GWL_STYLE and GWL_EXSTYLE (where it is WS_EX_TOPMOST). Weird.

    How can I check if it is modal (as opposed to topmost only)?

  6. #6
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    Ehe, now that's a good one.. So far the only thing I could get working with a 80% probability is to check the parent and check the parent if it also has TOPMOST. If so, you got a modal window on top of a TOP_MOST window.

  7. #7

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    I made two forms, set one as topmost and then launched the other one as modal, and it came out behind the topmost one

  8. #8
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    Lol, I had that problem soo many times
    You'll have to set the TOP_MOST for the Modal window too in the on_load.

  9. #9

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    That's what I though. Therefore, following that logic, shouldn't checking if WS_EX_TOPMOST is set always return a correct result?

  10. #10
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    Not 100% sure if it always returns the correct value. I always check both properties just to be really sure

  11. #11

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    All I have is the window handle. I'm creating a window class for easy access to VB form-style properties for any window

  12. #12
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: [RESOLVED] How do I find out if a window is Always On Top?

    The window handle is the key to a lot of stuff, just check if it has children or parents that remain within the ThunderMain

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width