public ForeignWpfHook(IWpfWindowHook hook, DcsMarshalledSource <T> source) { Contract.Requires(hook != null); Contract.Requires(source != null); this.Hook = hook; this.Source = source; }
public ForeignWpfHook <T> HookWpfWindow <T>(IntPtr hWnd, Type tHandler, object oParam = null) where T : class { Contract.Requires(tHandler != null); Contract.Requires(typeof(IWpfWindowHook).IsAssignableFrom(tHandler)); var source = new DcsMarshalledSource <T>(); var record = WpfHookRegistrationRecord.Create(hWnd, tHandler, typeof(T), oParam); var rh = Hook.RegisterWpfHook(record, source.ComProxy); return(new ForeignWpfHook <T>(rh, source)); }