public virtual bool OnNotify(NotifyMessageHeader hdr) { switch ((NotifyMessageCode)hdr.code) { case NotifyMessageCode.Apply: NativeWindowHelper.SetWindowLong(this.Handle, NativeWindowHelper.DWLP_MSGRESULT, NativeWindowHelper.PSNRET_NOERROR); OnApply(); return(true); case NotifyMessageCode.Reset: OnCancel(); return(false); case NotifyMessageCode.QueryCancel: return(false); case NotifyMessageCode.SetActive: OnSetActive(); return(true); case NotifyMessageCode.KillActive: if (ValidateOptions()) { OnKillActive(); NativeWindowHelper.SetWindowLong(this.Handle, NativeWindowHelper.DWLP_MSGRESULT, 0); } else { NativeWindowHelper.SetWindowLong(this.Handle, NativeWindowHelper.DWLP_MSGRESULT, 1); } return(true); } return(true); }
protected override void OnNotifyMessage(Message m) { Trace.WriteLine("OnNotifyMessage"); if (m.Msg == NativeWindowHelper.WM_NOTIFY && m.LParam != IntPtr.Zero) { NotifyMessageHeader hdr = (NotifyMessageHeader)Marshal.PtrToStructure(m.LParam, typeof(NotifyMessageHeader)); bool rc = OnNotify(hdr); m.Result = new IntPtr(rc ? 1 : 0); } }