PSN_WIZBACK notification code

Notifies a page that the user has clicked the Back button in a wizard. This notification code is sent in the form of a WM_NOTIFY message.

PSN_WIZBACK 

    lppsn = (LPPSHNOTIFY) lParam; 

Parameters

lParam

Pointer to a PSHNOTIFY structure that contains information about the notification code. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information.

Return value

Returns 0 to allow the wizard to go to the previous page. Returns -1 to prevent the wizard from changing pages. To display a particular page, return its dialog resource identifier. If the dialog was specified with the PSP_DLGINDIRECT flag, this notification returns the pointer to the dialog template.

Remarks

To set the return value, the dialog box procedure for the page must call the SetWindowLong function with the DWL_MSGRESULT value and return TRUE. For example:

case PSN_WIZBACK :
    SetWindowLong(hDlg, DWL_MSGRESULT, 0);
    break;

case PSN_WIZNEXT :
    ...

Note

The property sheet is in the process of manipulating the list of pages when the PSN_WIZBACK notification code is sent. You can add, insert, or remove pages in response to these notification codes, but special care must be taken if you insert or remove pages before the current page.

If you insert or remove pages before the current page, you must return (through DWL_MSGRESULT) a nonzero value to specify the desired new page. Note, however, that if you insert or remove a page that is located before the current page (that has a smaller index than the current page), PSN_KILLACTIVE might be sent to the wrong page.

For this reason, it is recommended that wizards that add and remove pages dynamically in response to PSN_WIZNEXT and PSN_WIZBACK do so only to pages at the end of the list. If you want your wizard to remove pages accurately, keep the dynamic pages at the end of the list and jump back to permanent pages before deleting them.

For example, suppose a wizard consists of an introductory page, a series of dynamic pages, and a completion page, and you want to delete the dynamic pages when the user reaches the completion page.

  1. The wizard would begin with two pages, "Introduction" and "Completion." The user begins on the "Introduction" page.
    1. Introduction (User is here)
    2. Completion
  2. When the user navigates away from "Introduction," the wizard adds the dynamic pages and places the user at the first dynamic page by returning (through DWL_MSGRESULT) the dialog identifier of the page "Dynamic 1." In this example, there are three dynamic pages.
    1. Introduction
    2. Completion
    3. Dynamic 1 (User is here)
    4. Dynamic 2
    5. Dynamic 3
  3. After the user navigates through the dynamic pages to "Dynamic 3" and then navigates to the next page, the application should place the user at the page "Completion." Again, this is done by returning (through DWL_MSGRESULT) the dialog identifier of the page "Completion."
    1. Introduction
    2. Completion (User is here)
    3. Dynamic 1
    4. Dynamic 2
    5. Dynamic 3
  4. The application can then remove the three dynamic pages (numbered three through five) safely.
    1. Introduction
    2. Completion (User is here)

Note that this technique is necessary only if your wizard removes pages dynamically. If your wizard only adds pages dynamically, this process is not necessary.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Prsht.h