PSN_APPLY notification code
Sent to every page in the property sheet to indicate that the user has clicked the OK, Close, or Apply button and wants all changes to take effect. This notification code is sent in the form of a WM_NOTIFY message.
PSN_APPLY
lppsn = (LPPSHNOTIFY) lParam;
Parameters
-
lParam
-
Pointer to a PSHNOTIFY structure that contains information about the notification code, including the ID of the page.
Return value
Set PSNRET_NOERROR to indicate that the changes made to this page are valid and have been applied. If all pages set PSNRET_NOERROR, the property sheet can be destroyed. To indicate that the changes made to this page are invalid and to prevent the property sheet from being destroyed, set one of the following return values:
- PSNRET_INVALID. The property sheet will not be destroyed, and focus will be returned to this page.
- PSNRET_INVALID_NOCHANGEPAGE. The property sheet will not be destroyed, and focus will be returned to the page that had focus when the button was pressed.
To set the return value, the dialog box procedure for the page must call the SetWindowLong function with the DWL_MSGRESULT value, and the dialog box procedure must return TRUE.
Remarks
When the user clicks the OK, Apply, or Close button, the property sheet sends a PSN_KILLACTIVE notification to the active page, giving it an opportunity to validate the user's changes. If the changes are valid, the property sheet sends a PSN_APPLY notification code to each page, directing it to apply the new properties to the corresponding item.
Note
The property sheet is in the process of manipulating the list of pages when the PSN_APPLY notification code is sent. Do not attempt to add, remove, or insert pages while handling this notification. Doing so will have unpredictable results.
The lParam member of the PSHNOTIFY structure pointed to by lParam is set to TRUE if the user clicks the OK button. It is also set to TRUE if the PSM_CANCELTOCLOSE message has been sent and the user clicks the Close button. It is set to FALSE if the user clicks the Apply button.
The PSHNOTIFY structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet.
Do not call the EndDialog function when processing this notification code.
A modal property sheet is destroyed if the user clicks the OK button and every page returns the PSNRET_NOERROR value in response to PSN_APPLY. If any page returns PSNRET_INVALID or PSNRET_INVALID_NOCHANGEPAGE, the Apply process is canceled immediately. Pages after the cancelling page will not receive a PSN_APPLY notification code.
To receive this notification code, a page must set the DWL_MSGRESULT value to FALSE in response to the PSN_KILLACTIVE notification code.
Note
This notification code is not supported when using the Aero wizard style (PSH_AEROWIZARD).
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
Header |
|