Skip to content

Commit 257ec2b

Browse files
author
jantari
committed
print WindowTitle in debug output to log it for non-interactable windows too
1 parent 6fdb9ff commit 257ec2b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

private/Debug-LongRunningProcess.ps1

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'Height' = $RECT.Bottom - $RECT.Top
3131
'IsVisible' = $IsVisible
3232
'IsDisabled' = ($style -band $WS_DISABLED) -eq $WS_DISABLED
33-
'Style' = $style
33+
'StyleHex' = '0x{0:X8}' -f $style
3434
'UIAWindowTitle' = ''
3535
'UIAElements' = @()
3636
}
@@ -155,7 +155,10 @@
155155
})
156156
}
157157

158-
Write-Debug " ThreadWindow ${window}, IsVisible: $($WindowInfo.IsVisible), IsDisabled: $($WindowInfo.IsDisabled), Style: $($WindowInfo.Style), Size: $($WindowInfo.Width) x $($WindowInfo.Height):"
158+
# Even if a window is not interactable (not visible and/or disabled) it is worth logging in debug mode,
159+
# because for example windows in session 0 will never be visible or interactable but can still open and cause a hang
160+
Write-Debug " ThreadWindow ${window}, Title: $($WindowInfo.UIAWindowTitle)"
161+
Write-Debug " IsVisible: $($WindowInfo.IsVisible), IsDisabled: $($WindowInfo.IsDisabled), Style: $($WindowInfo.StyleHex), Size: $($WindowInfo.Width) x $($WindowInfo.Height):"
159162
Write-Debug " UIA Info: Got $($WindowInfo.UIAElements.Count) UIAElements from this window handle:"
160163
foreach ($UIAElement in $WindowInfo.UIAElements) {
161164
if ($UIAElement.Text) {

0 commit comments

Comments
 (0)