I have the following script which tells me what window is in the top of the order, does someone have a script that list the position for all windows.
Code:
Private Declare Function GetTopWindow Lib "user32.dll" (ByVal hWnd As Long) As Long Private Declare Function GetNextWindow Lib "user32.dll" Alias "GetWindow" (ByVal hWnd As Long, ByVal wFlag As Long) As Long Private Declare Function IsWindowVisible Lib "user32.dll" (ByVal hWnd As Long) As Long Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long Private Sub Timer1_Timer() Timer1.Enabled = False Dim topHwnd As Long topHwnd = GetTopWindow(topHwnd) Do While topHwnd If IsWindowVisible(topHwnd) Then ' test for windows that can be at top but you don't care about ' for example, the taskbar will probably be the top window most of the time ' You may want to get the window class(es) of such windows & ignore the windows, ' if they are of that class ' Do not Exit the loop if it is a window you don't care about Exit Do End If topHwnd = GetNextWindow(topHwnd, 2&) Loop If topHwnd = 0& Then MsgBox "No visible windows exist" Else Dim sCaption As String Dim lLen As Long lLen = GetWindowTextLength(topHwnd) If lLen Then sCaption = Space$(lLen) GetWindowText topHwnd, sCaption, lLen + 1 Else sCaption = "[Window has no caption]" End If MsgBox "Top window caption:" & vbNewLine & sCaption End If End Sub