Ejemplo n.º 1
0
        public ForeignWpfHook(IWpfWindowHook hook, DcsMarshalledSource <T> source)
        {
            Contract.Requires(hook != null);
            Contract.Requires(source != null);

            this.Hook   = hook;
            this.Source = source;
        }
Ejemplo n.º 2
0
        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));
        }