ZetupEXE Posted November 21, 2010 Posted November 21, 2010 Hi there, i am just on step ahead to finish my little project, but now i am struggling for two weeks now with a annoying problem. So i hope you guys can help me out a last time?! The description of my problem is quite short: How can i find out whether my GUI is over all other Windows? i would like to thank all of you for your great help. cu.. Zetup-EXE
martin Posted November 21, 2010 Posted November 21, 2010 (edited) Hi there,i am just on step ahead to finish my little project, but now i am struggling for two weeks now with a annoying problem.So i hope you guys can help me out a last time?! The description of my problem is quite short:How can i find out whether my GUI is over all other Windows?i would like to thank all of you for your great help.cu..Zetup-EXEThe position of a window is given by its Z-order. The easiest way I know of with Autoit is the use WinList function. The first window in the list is the topmost window (Same as the order of applications shown when you press Alt TAB). So if your window is the first in the list of visible windows it's on top of all others. Edited November 21, 2010 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
ZetupEXE Posted November 24, 2010 Author Posted November 24, 2010 @martin: thanks for your tip. u'r tip solved my problem and so my project finished as version 1.0 i did the following to get the "guiontop"-state: If WinGetTitle($osName) = WinGetTitle("[active]") Then .... EndIf thx. Zetup-EXE
KaFu Posted November 24, 2010 Posted November 24, 2010 (edited) Topmost property is defined by the ExStyle $WS_EX_TOPMOST and can be determined with _WinAPI_GetWindowLong(). #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> GUICreate("My TOPMOST GUI #1", Default, Default, Default, Default, Default, $WS_EX_TOPMOST) GUISetState(@SW_SHOW) $hwnd = GUICreate("My TOPMOST GUI #2") GUISetState(@SW_SHOW) WinSetOnTop($hwnd,"",1) $var = WinList() For $i = 1 To $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then ConsoleWrite("Title=" & $var[$i][0] & @TAB & "Handle=" & $var[$i][1] & @TAB & "IsTopmost=" & BitAND(_WinAPI_GetWindowLong($var[$i][1], $GWL_EXSTYLE), $WS_EX_TOPMOST) & @CRLF) EndIf Next While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Edit: Added WinSetOnTop() example. Edited November 24, 2010 by KaFu Fr33b0w 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
martin Posted November 26, 2010 Posted November 26, 2010 Topmost property is defined by the ExStyle $WS_EX_TOPMOST and can be determined with _WinAPI_GetWindowLong(). #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> GUICreate("My TOPMOST GUI #1", Default, Default, Default, Default, Default, $WS_EX_TOPMOST) GUISetState(@SW_SHOW) $hwnd = GUICreate("My TOPMOST GUI #2") GUISetState(@SW_SHOW) WinSetOnTop($hwnd,"",1) $var = WinList() For $i = 1 To $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then ConsoleWrite("Title=" & $var[$i][0] & @TAB & "Handle=" & $var[$i][1] & @TAB & "IsTopmost=" & BitAND(_WinAPI_GetWindowLong($var[$i][1], $GWL_EXSTYLE), $WS_EX_TOPMOST) & @CRLF) EndIf Next While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Edit: Added WinSetOnTop() example. That doesn't tell you which window is on top of all others though. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now