EDIT: My mistake, here is the thread with your problem - http://social.msdn.microsoft.com/forums/en-US/wpf/thread/21c88fed-c84c-47c1-9012-7c76972e8c1c
and be more specific ( full trust settings are required for this code)
using System.Windows.Interop; using System.Runtime.InteropServices; [DllImport("user32", ExactSpelling = true, CharSet = CharSet.Auto)] private static extern IntPtr GetAncestor(IntPtr hwnd, int flags); [DllImport("user32", CharSet = CharSet.Auto)] private static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam); private void button1_Click(object sender, RoutedEventArgs e) { WindowInteropHelper wih = new WindowInteropHelper(Application.Current.MainWindow); IntPtr ieHwnd = GetAncestor(wih.Handle, 2); PostMessage(ieHwnd, 0x10, IntPtr.Zero, IntPtr.Zero); }
source share