Helomotorola Posted November 28, 2007 Share Posted November 28, 2007 How does to know a window is Topmost?? Thank much Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 28, 2007 Share Posted November 28, 2007 You mean like just using Msgbox(0,'',WinGetTitle('')) Or finding out if the window is always on top? Link to comment Share on other sites More sharing options...
ame1011 Posted November 28, 2007 Share Posted November 28, 2007 if u mean check for active window WinActive ("window title") [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 28, 2007 Share Posted November 28, 2007 To test for the $WS_EX_TOPMOST property, use something like this: $hWin = WinGetHandle("Untitled - Notepad") $avStyles = GUIGetStyle($hWin) ; [0] = Style, [1] = ExStyle $fTopMost = BitAND($avStyles[1], $WS_EX_TOPMOST) If $fTopMost Then ConsoleWrite("Debug: Window with handle $hWin has $WS_EX_TOPMOST set.") Else ConsoleWrite("Debug: Window with handle $hWin does not have $WS_EX_TOPMOST set.") EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
photonbuddy Posted May 9, 2008 Share Posted May 9, 2008 Sorry for bringing an old thread back to life, but I also need this question answered. The script posted by PsaltyDS doesn't work as I'm not using an AutoIT GUI, but rather a third party program created window. Any idea how to read the topmost field of a non AutoIT window? Link to comment Share on other sites More sharing options...
weaponx Posted May 9, 2008 Share Posted May 9, 2008 (edited) Sorry for bringing an old thread back to life, but I also need this question answered. The script posted by PsaltyDS doesn't work as I'm not using an AutoIT GUI, but rather a third party program created window. Any idea how to read the topmost field of a non AutoIT window? So? You enter the title of your 3rd party window. Const $WS_EX_TOPMOST = 0x8 $hWin = WinGetHandle("Untitled - Notepad") $avStyles = GUIGetStyle($hWin) ; [0] = Style, [1] = ExStyle $fTopMost = BitAND($avStyles[1], $WS_EX_TOPMOST) If $fTopMost Then ConsoleWrite("Debug: Window with handle $hWin has $WS_EX_TOPMOST set.") Else ConsoleWrite("Debug: Window with handle $hWin does not have $WS_EX_TOPMOST set.") EndIf Edited May 9, 2008 by weaponx Link to comment Share on other sites More sharing options...
ProgAndy Posted May 9, 2008 Share Posted May 9, 2008 No, this doesn't work. GUIGetStyle only works with Au3-Windows. Use this instead $hWin = WinGetHandle("Untitled") $fTopMost = _WinIsOnTop($hWin) If $fTopMost Then ConsoleWrite("Debug: Window with handle $hWin has $WS_EX_TOPMOST set.") Else ConsoleWrite("Debug: Window with handle $hWin does not have $WS_EX_TOPMOST set.") EndIf ;=============================================================================== ; ; Function Name: _WinIsOnTop ; Description:: Gets the OnTop State of a window ; Parameter(s): $WindowHandle : Handle or Title of Window ; Requirement(s): WinAPI.au3 ; Return Value(s): Window OnTop: True, otherwise False ; Author(s): Prog@ndy ; ;=============================================================================== ; Func _WinIsOnTop($WindowHandle) Local $long = DllCall("User32.dll", "int", "GetWindowLong", "hwnd", WinGetHandle($WindowHandle), "int", -20) Return BitAND($long[0],8)=8 ; $WS_EX_TOPMOST = 8 EndFunc Decibel 1 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 9, 2008 Share Posted May 9, 2008 No, this doesn't work. GUIGetStyle only works with Au3-Windows. Use this instead $hWin = WinGetHandle("Untitled") $fTopMost = _WinIsOnTop($hWin) If $fTopMost Then ConsoleWrite("Debug: Window with handle $hWin has $WS_EX_TOPMOST set.") Else ConsoleWrite("Debug: Window with handle $hWin does not have $WS_EX_TOPMOST set.") EndIf ;=============================================================================== ; ; Function Name: _WinIsOnTop ; Description:: Gets the OnTop State of a window ; Parameter(s): $WindowHandle : Handle or Title of Window ; Requirement(s): WinAPI.au3 ; Return Value(s): Window OnTop: True, otherwise False ; Author(s): Prog@ndy ; ;=============================================================================== ; Func _WinIsOnTop($WindowHandle) Local $long = DllCall("User32.dll", "int", "GetWindowLong", "hwnd", WinGetHandle($WindowHandle), "int", -20) Return BitAND($long[0],8)=8 ; $WS_EX_TOPMOST = 8 EndFunc You've got the right idea, but this is already included in AutoIt as _WinAPI_GetWindowLong(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ProgAndy Posted May 9, 2008 Share Posted May 9, 2008 (edited) I know, but this way it's easier to use and you don't have to include the whole UDF just for 1 line of code The only line from WInAPI.au3 is the DLLcall.... WINAPI.au3 has 4698 lines Edited May 9, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
photonbuddy Posted May 9, 2008 Share Posted May 9, 2008 I know, but this way it's easier to use and you don't have to include the whole UDF just for 1 line of code The only line from WInAPI.au3 is the DLLcall.... WINAPI.au3 has 4698 lines This is true.Looking at your code, is there a reason why you use wingethandle() in the dllcall line when you already have the handle of the window passed-in?Thanks to both yourself and PsaltyDS for the fast reply. Link to comment Share on other sites More sharing options...
ProgAndy Posted May 9, 2008 Share Posted May 9, 2008 Looking at your code, is there a reason why you use wingethandle() in the dllcall line when you already have the handle of the window passed-in?It's to use it easier. You can pass a WindowTitle, too, When you do it this way :=) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
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