WindowsFおrmでは、OverrideできたWndProcだけども、
WPFからはなくなっている。
しかし、それでも使いたい場合もあるだろう。
WPFからはなくなっている。
しかし、それでも使いたい場合もあるだろう。
ということで、以下の参考
C#
void Window1_Loaded(object sender, RoutedEventArgs e)
{
HwndSource 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)
{
//なにか
}