Sign in to follow this  
Followers 0
Skizmata

Window Topmost Property

9 posts in this topic

#1 ·  Posted (edited)

I am looking for a way to know if a window has the topmost attribute. I feel I have searched high and low and greatly look forward to your help.

***EDIT*** To be clear I mean the attribute set by WinSetOnTop() not the current highest window in z order. (Thanks for point this out JohnOne)

I don't want to have to do a work around hack (invisible windows over other windows sort of thing).

If you find a thread I have missed in my searching that addresses this I would gladly have this one deleted.

I found some info on msdn(http://msdn.microsoft.com/en-us/library/system.windows.window.topmost.aspx) that I thought looked promising. Is this telling me that a DllCall to PresentationFramework.dll is what I need to get the .Topmost property out of a window? If so how do I learn how to go about that. I have had little success with understanding how to track down how to do a DllCall.

If I'm barking up the wrong tree a nudge in the right direction would be appreciated.

Thanks

Edited by Skizmata

AutoIt changed my life.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have found that winlist returns windows in there z order, so the first window found in winlist() is the topmost.

Actually, its asked quite a few times, perhaps is one of the devs confirms this, it might one day be added to the remarks in the documentation, if its worth it.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thanks JohnOne that is a good place to start looking. Unfortunately I think I wasn't clear in my first post (I hope I can fist it after I post this in case no one reads on). I'm looking for the attribute set in AutoIt by WinSetOnTop() not necessarily the windows that are at the top at any given moment. True these are likly one and the same but a window with WinSetOnTop() true can be minimized or under another window with that attribute also set to true. I hope I am making myself more clear.

Thanks again JohnOne for a quick interaction.


AutoIt changed my life.

Share this post


Link to post
Share on other sites

Skizmata,

You can get the currently set styles by calling the API like this: :graduated:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("Test", 500, 500, -1, -1, -1, $WS_EX_TOPMOST)
GUISetState()
$iExStyle = _WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE)

If BitAnd($iExStyle, $WS_EX_TOPMOST) Then
    ConsoleWrite("TopMost set!" & @CRLF)
Else
    ConsoleWrite("Normal" & @CRLF)
EndIf

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($hGUI)
            ExitLoop
    EndSwitch
WEnd

$hGUI = GUICreate("Test", 500, 500)
GUISetState()
$iExStyle = _WinAPI_GetWindowLong($hGUI, $GWL_EXSTYLE)

If BitAnd($iExStyle, $WS_EX_TOPMOST) Then
    ConsoleWrite("TopMost set!" & @CRLF)
Else
    ConsoleWrite("Normal" & @CRLF)
EndIf

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

If you use $GWL_STYLE in the API call, you get the normal styles in case that was your next question. :(

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Wonderful! Melba23!

Stop the clock at just under 15 minutes the AutoIt forums does it again. This is as I'm sure you well know, exactly what I was hunting for. I can't thank you enough. But just to make this thread even better for any future seekers that discover it. If you where to reverse engineer my situation using the help file, the forums and web searches what is the most likely way I would have found this on my own?

It appears to me I need to read and understand WinAPI.au3 thank you so much!


AutoIt changed my life.

Share this post


Link to post
Share on other sites

The trick is to read and understand the Help file.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Skizmata,

Reading the Setting Styles tutorial in the Wiki would have given you the solution immediately. :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks Melba23 I didn't even know the wiki existed. Those who can actually help instead of posting obvious flame bate have no doubt earned the MVP group status.

Thanks for adding this to the wiki.


AutoIt changed my life.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0