A UDI wizard page has methods that correspond to each stage (or phase) of the life cycle of the page. As a part of creating your custom wizard page, you need to override these methods with your code. Table 2 lists the methods that you will need to override and provides a brief description of each method, including when to use the method in the wizard page life cycle.

Table 2. Methods in a Wizard Page Life Cycle

Method

Description

OnWindowCreated

This method is called once, after the page’s window has been created.

For this method, write code that initializes the page for the first time and only needs to be performed once. For example, use this method to initialize fields or to read configuration information from the Setter elements in the UDI Wizard configuration file.

OnWindowShown

This method is called each time the page is displayed (shown) in the UDI Wizard. It is called the first time the page is displayed and each time you navigate to the page by clicking Next or Back in the wizard.

For this method, write code that prepares the page to be displayed—for example, reading memory variables, task sequence variables, or environment variables, and then updating the page based on any changes to those variables.

OnCommonControlEvent

This method can be called anytime the wizard page is displayed and receives a WM_NOTIFY message from a child (typically, common controls).

For this method, write code that handles WM_NOTIFY based on the notification message. For example, you may want to respond to events from a common control, such as responding to click or double-click events for a TreeView control.

OnUnhandledEvent

This method is called anytime an unhandled window message occurs for your wizard page. This method provides the opportunity to intercept and handle these otherwise unhandled window messages.

For this method, write code that handles the window messages that are pertinent to your wizard page. Typically, you will not need to override this method.

OnNextClicked

This method is called when you click Next in the wizard.

For this method, write code that performs any necessary actions before moving to the next wizard page—for example, performing validation that can take a long time. If the validation fails, you can cancel the Next request and display a message.

OnWindowHidden

This method is called each time the page is hidden when either the previous or next wizard page is shown.

For this method, write code that performs any actions before the page is hidden, prior to another page being shown. Typically, you will not need to override this method.

 

Related Topics

Review the SamplePage Visual Studio Solution