private static Client CreateClient( IntPtr hwnd ) { var title = ThreadWindowHandles.GetWindowText( hwnd ); if ( title == string.Empty ) { title = ThreadWindowHandles.GetClassText( hwnd ); } Client client = Types.createClient( hwnd , ThreadWindowHandles.GetParent( hwnd ) , ( int )User32Methods.GetWindowThreadProcessId( hwnd , IntPtr.Zero ) , WindowStyle( hwnd ) , title ); return client; }