@@ -58,6 +58,7 @@ public static WindowInformation GetWindowInformation(IntPtr hWnd)
5858 var realWindowClass = RealGetWindowClass ( hWnd ) ;
5959 var hWndParent = NativeMethods . GetParent ( hWnd ) ;
6060 var size = GetWindowSize ( hWnd ) ;
61+ var placement = GetWindowPlacement ( hWnd ) ;
6162 var threadId = NativeMethods . GetWindowThreadProcessId ( hWnd , out var processId ) ;
6263 var process = GetProcessByIdSafely ( processId ) ;
6364
@@ -83,7 +84,8 @@ public static WindowInformation GetWindowInformation(IntPtr hWnd)
8384 }
8485
8586 windowDetailes . Add ( "Window Handle" , $ "0x{ hWnd . ToInt64 ( ) : X} ") ;
86- windowDetailes . Add ( "Parent Window Handle" , $ "0x{ hWndParent . ToInt64 ( ) : X} ") ;
87+ windowDetailes . Add ( "Parent Window Handle" , hWndParent == IntPtr . Zero ? "-" : $ "0x{ hWndParent . ToInt64 ( ) : X} ") ;
88+ windowDetailes . Add ( "Window Placement" , placement . showCmd . ToString ( ) ) ;
8789 windowDetailes . Add ( "Window Size" , $ "{ size . Width } x { size . Height } ") ;
8890
8991 try
@@ -175,13 +177,18 @@ public static WindowInformation GetWindowInformation(IntPtr hWnd)
175177 {
176178 }
177179
180+ processDetailes . Add ( "Process Id" , processId . ToString ( ) ) ;
178181 try
179182 {
180- processDetailes . Add ( "Parent" , Path . GetFileName ( process . GetParentProcess ( ) . MainModule . FileName ) ) ;
183+ var parentProcess = process . GetParentProcess ( ) ;
184+ processDetailes . Add ( "Parent Process Id" , parentProcess . Id . ToString ( ) ) ;
185+ processDetailes . Add ( "Parent" , Path . GetFileName ( parentProcess . MainModule . FileName ) ) ;
181186 }
182187 catch
183188 {
184189 }
190+
191+ processDetailes . Add ( "Thread Id" , threadId . ToString ( ) ) ;
185192
186193 try
187194 {
@@ -191,8 +198,6 @@ public static WindowInformation GetWindowInformation(IntPtr hWnd)
191198 {
192199 }
193200
194- processDetailes . Add ( "Process Id" , processId . ToString ( ) ) ;
195- processDetailes . Add ( "Thread Id" , threadId . ToString ( ) ) ;
196201
197202 try
198203 {
@@ -289,6 +294,14 @@ private static Rect GetWindowSize(IntPtr hWnd)
289294 return size ;
290295 }
291296
297+ private static WINDOWPLACEMENT GetWindowPlacement ( IntPtr hWnd )
298+ {
299+ var placement = new WINDOWPLACEMENT ( ) ;
300+ placement . length = Marshal . SizeOf ( placement ) ;
301+ NativeMethods . GetWindowPlacement ( hWnd , ref placement ) ;
302+ return placement ;
303+ }
304+
292305 private static Process GetProcessByIdSafely ( int pId )
293306 {
294307 try
0 commit comments