I have looked and have not found any command to do anything with a second to active window, or a list of windows in top to bottom order or anything. I have a program that needs to find out if a window is second to top. I don't know but I hope there is a dll to do this.
thanks
Find window below window.
- dangerdogL2121
- Posts: 173
- Joined: 01 Oct 2013, 23:11
- Blackholyman
- Posts: 1293
- Joined: 29 Sep 2013, 22:57
- Location: Denmark
- Contact:
Re: Find window below window.
you can try this
This script by Lexikos also has a function that does this well...
Code: Select all
;~ http://msdn.microsoft.com/en-us/library/ms633515.aspx
DetectHiddenWindows, on
GW_HWNDNEXT=2 ; Returns a handle to the window below the given window.
GW_HWNDPREV=3 ; Returns a handle to the window above the given window.
hWnd := WinExist("A")
below := DllCall("GetWindow", "uint", hWnd, "uint", GW_HWNDNEXT)
WinGetPos, x,y,w,h, % "AHk_id " below
WinGetTitle, title, % "AHk_id " below
msgbox % X " and " y " and " w " and " h " and " title
return
Courses on AutoHotkey
My Autohotkey Blog
- dangerdogL2121
- Posts: 173
- Joined: 01 Oct 2013, 23:11
Re: Find window below window.
The first thing I got was
50 and 50 and 132 and 38 and
And when I changed to this I got this
0 and 0 and 0 and 0 and
I also tried modifying the script to this.
But it doesn't find any window with internet explorer.
Also I didn't get any message box from Lexikos's script, but I think I could modify it for me if I tried. It would be so nice if there was a simple command to do this.
thanks for your help
50 and 50 and 132 and 38 and
And when I changed
Code: Select all
below := DllCall("GetWindow", "uint", hWnd, "uint", GW_HWNDNEXT)
Code: Select all
below := DllCall("GetWindow", "uint", hWnd, "uint", GW_HWNDPREV)
0 and 0 and 0 and 0 and
I also tried modifying the script to this.
Code: Select all
;~ http://msdn.microsoft.com/en-us/library/ms633515.aspx
DetectHiddenWindows, on
GW_HWNDNEXT=2 ; Returns a handle to the window below the given window.
GW_HWNDPREV=3 ; Returns a handle to the window above the given window.
hWnd := WinExist("A")
Loop, 50
{
GW_HWNDNEXT=%A_Index%
below := DllCall("GetWindow", "uint", hWnd, "uint", GW_HWNDNEXT)
IfInString, below, Internet Explorer
msgbox, %below%
}
WinGetPos, x,y,w,h, % "AHk_id " below
WinGetTitle, title, % "AHk_id " below
msgbox % X " and " y " and " w " and " h " and " title
return
Also I didn't get any message box from Lexikos's script, but I think I could modify it for me if I tried. It would be so nice if there was a simple command to do this.
thanks for your help
Re: Find window below window.
i get 0 and 0 and 0 and 0 and M
Re: Find window below window.
WinGet,, List
http://www.autohotkey.com/docs/commands/WinGet.htm
http://www.autohotkey.com/docs/commands/WinGet.htm
List: Retrieves the unique ID numbers of all existing windows that match the specified WinTitle, WinText, ExcludeTitle, and ExcludeText (to retrieve all windows on the entire system, omit all four title/text parameters). Each ID number is stored in an array element whose name begins with OutputVar's own name, while OutputVar itself is set to the number of retrieved items (0 if none). For example, if OutputVar is MyArray and two matching windows are discovered, MyArray1 will be set to the ID of the first window, MyArray2 will be set to the ID of the second window, and MyArray itself will be set to the number 2. Windows are retrieved in order from topmost to bottommost (according to how they are stacked on the desktop). Hidden windows are included only if DetectHiddenWindows has been turned on. Within a function, to create an array that is global instead of local, declare MyArray as a global variable prior to using this command (the converse is true for assume-global functions).
- dangerdogL2121
- Posts: 173
- Joined: 01 Oct 2013, 23:11
Re: Find window below window.
That's it!
I didn't think it would work just from looking at it because it said
@Blackholyman
You probably thought I wanted something else. Thanks for your help.
@Guest3456
Thanks a million!
I didn't think it would work just from looking at it because it said
but I didn't realize that it finds all windows in top to bottom order and that ifleave the last four parameters blank it finds all the windows.Retrieves the unique ID numbers of all existing windows that match the specified WinTitle, WinText, ExcludeTitle, and ExcludeText
@Blackholyman
You probably thought I wanted something else. Thanks for your help.
@Guest3456
Thanks a million!
Re: Find window below window.
Apropos "but I didn't realize that it finds all windows in top to bottom order and that if leave the last four parameters blank it finds all the windows," i ran the following code, but then i got a blank message:
Code: Select all
WinGet, OutputVar, PID,
MsgBox % Outputvar
- dangerdogL2121
- Posts: 173
- Joined: 01 Oct 2013, 23:11
Re: Find window below window.
I almost posted once, but I closed the Internet Explorer window and had to restart again so this will be brief.
The problem is that you don't list a window title in your WinGet
This might be what you need
Try this out
Thanks again guys
The problem is that you don't list a window title in your WinGet
This might be what you need
Code: Select all
WinGet, OutputVar, PID, A ;specifying "A" in the third parameter will give you the stats for the active(top) window.
MsgBox % Outputvar
Actually I saved some code for an example of WinGet, OutputVar, ListI almost posted once, but I closed the Internet Explorer window and had to restart again so this will be brief.
Try this out
Code: Select all
;A cool window list script made by dangerdogL2121
DetectHiddenWindows, Off
WinGet, OutputID, List
Loop
{
OutputID = % OutputID%A_Index%
if OutputID =
break
WinGetTitle, OutputTitle, ahk_id %OutputID%
WinGet, OutputPID, PID, ahk_id %OutputID%
text = %text%`nWindow number %A_Index%:`nWindow Name = %OutputTitle%`nWindow ID = %OutputID%`nWindow PID = %OutputPID%`n--------------------------------------
}
;next part added to show all window stats
Gui, add, edit, h500, %text%
Gui, Show, Center
Last edited by dangerdogL2121 on 15 Oct 2013, 10:02, edited 1 time in total.
Re: Find window below window.
not so cool gettin' error at line 11...
Code: Select all
;A cool window list script made by dangerdogL2121
DetectHiddenWindows, Off
WinGet, OutputID, List
Loop
{
OutputID = % OutputID%A_Index%
if OutputID =
break
WinGetTitle, OutputTitle, ahk_id %OutputID%
WinGet, OutputPID, PID, ahk_id %OutputID%
text = %text%`nWindow number %A_Index%:`nWindow Name = %OutputTitle%`nWindow ID = %OutputID%`nWindow PID = %OutputPID
%`n--------------------------------------
}
;next part added to show all window stats
Gui, add, edit, h500, %text%
Gui, Show, Center
- dangerdogL2121
- Posts: 173
- Joined: 01 Oct 2013, 23:11
Re: Find window below window.
Sorry about that.
I changed my code in my previous post. I think it will work now.
I changed my code in my previous post. I think it will work now.
Who is online
Users browsing this forum: Google [Bot], JoeWinograd, yabab33299 and 126 guests