protected override void OnLoad(EventArgs e) { base.OnLoad(e); proc = ForeignProcess.Get(Target); hookResults = WMKeyDownHook.Get(proc, Target); hookResults .ObserveOn(this) .Subscribe( t => listBox1.Items.Add(t), () => Close() ); }
public WpfLogForm(ForeignProcess process, IntPtr hwnd) { InitializeComponent(); this.Process = process; this.Hook = process.HookWpfWindow <WpfHookResult>(hwnd, typeof(TargetWpfHook), new WpfHookParam()); this.Hook .ObserveOn(this) .Subscribe( t => lbLog.Items.Add(t.Message), () => Close()); this.Hook.Invoke(); }
public Form1() { InitializeComponent(); var demoProcess = Process.GetProcessesByName("Itp.Win32.DemoMdiApplication").SingleOrDefault(); if (demoProcess != null) { window = ForeignMdiWindow.Get(demoProcess); } else { foreach (var a in this.Controls.Cast <Control>()) { if (a == btHookNotepad || a == btHookWpf) { // no-op } else { a.Enabled = false; } } } var demoWpfProcess = Process.GetProcessesByName("Itp.Win32.DemoWpfTarget").SingleOrDefault(); if (demoWpfProcess != null) { wpfWindow = ForeignProcess.Get(demoWpfProcess); wpfWindowIntPtr = demoWpfProcess.MainWindowHandle; } else { btHookWpf.Enabled = false; } }
public static ForeignHook <string> Get(ForeignProcess process, IntPtr hwnd) { return(process.HookWindow <string>(hwnd, typeof(WMKeyDownHook))); }