Hi
I am new to WPF Browser Application/WPF.
I found code to close browswer when click Exit button,
but cannot find how to close Tab instead whole browser?
Normal our clients will run at least two XBAP in separated Tab of IE, when user close one XBAP it leavs a blank Tab using following code
Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown
Application.Current.Shutdown()
I need your help! Any ideas?
I am using Visual Studio 2010 on Windows 7/Vista machines.
Thanks
Fred
Following code will close whole browser:
<DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> _
Public Shared Function GetAncestor(ByVal hWnd As IntPtr, ByVal flags As Integer) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean
End Function
Dim ieHwnd As New IntPtr
Dim wih As WindowInteropHelper = New WindowInteropHelper(Application.Current.MainWindow)
ieHwnd = GetAncestor(wih.Handle, 2)
PostMessage(ieHwnd, CLng("&H" & 10), IntPtr.Zero, IntPtr.Zero)