protected override IntPtr OnHook(int code, IntPtr wparam, IntPtr lparam) { switch (code) { case (int)WindowHookCode.Activate: WindowActivatingEventArgs args = new WindowActivatingEventArgs(new Window(wparam)); this.OnActivating(args); if (args.Cancel) { return new IntPtr(1); } return IntPtr.Zero; default: return base.OnHook(code, wparam, lparam); } }
/// <summary> /// Raises the <see cref="Activating"/> event. /// </summary> /// <param name="e">The <see cref="T:SmartCore.Interop.Windows.WindowActivatingEventArgs"/> instance containing the event data.</param> protected virtual void OnActivating(WindowActivatingEventArgs e) { if (Activating != null) Activating(this, e); }