bool HandleNotification(IntPtr longParameter)
        {
            NMHDR header = (NMHDR)Marshal.PtrToStructure(longParameter, typeof(NMHDR));

            if (header.hwndFrom != windowUnmanagedParent &&
                header.hwndFrom != SafeNativeMethods.GetParent(windowUnmanagedParent))
            {
                return(false);
            }

            switch ((int)header.code)
            {
            case PSN.KILLACTIVE:
                return(OnBeforeApplyChanges());

            case PSN.APPLY:
                return(OnApplyChanges());

            case PSN.QUERYCANCEL:
                return(true);

            default:
                return(false);
            }
        }
        public bool PropPageDialogProc(IntPtr windowDialog, UInt32 message, IntPtr wordParameter, IntPtr longParameter)
        {
            if (this.windowUnmanagedParent == IntPtr.Zero)
            {
                this.windowUnmanagedParent = windowDialog;
            }

            switch (message)
            {
            case WM.INITDIALOG:
                try
                {
#pragma warning suppress 56523
                    IntPtr parent = SafeNativeMethods.GetParent(windowUnmanagedParent);
                    wsatControl = new WsatControl(windowUnmanagedParent, parent, this);

                    if (Utilities.OSMajor > 5)
                    {
                        wsatControl.Size = new System.Drawing.Size(425, wsatControl.Size.Height);
                    }

#pragma warning suppress 56523
                    SafeNativeMethods.SetParent(wsatControl.Handle, this.windowUnmanagedParent);
                    activeItem.Add(propSheet);
                }
                catch (WsatAdminException ex)
                {
                    ShowErrorDialog(ex.Message);
                    return(false);
                }
                return(true);

            case WM.DESTROY:
                return(true);

            case WM.NOTIFY:
                return(HandleNotification(longParameter));

            case WM.SHOWWINDOW:
                OnShowPropertyPage(wordParameter != IntPtr.Zero);
                return(true);

            default:
                return(false);
            }
        }