Developer, Former MVP, now at Microsoft - Best of 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
protected override void WndProc(ref Message m) { // e.g. deal with message for // composition changed, power state notification, restart manager aware etc }
void Window1_Loaded(object sender, RoutedEventArgs e) { source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle); source.AddHook(new HwndSourceHook(WndProc)); } private static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { // TODO handle WM_ }