Partager via


Implement an Apply Handler for Each Page

The Applications snap-in intercepts the Apply notification on tab zero Application tab. This is the only tab that is likely to have been visited. Unvisited tabs do not get an Apply notification, however all visited tabs will get the notification from the property sheet. This event should be ignored by the property pages of the extension to the Applications snap-in.

Instead of handling the apply message, implement an Apply handler that traps the OnQuerySiblings( 0xFF00, 0 ) message, which Group Policy preference Applications extension sends from tab zero to notify the extensions to read or write from the IXMLDOMDocument object. This message is passed by tab zero to each tab, sequentially, during an apply event. Any tab can suspend the Apply (due to data validation failure or other reason) by returning a nonzero value.

Note

The above process ensures that a visited tab handles the apply notification and that each tab has completed its Apply before the XML document is released. Tab zero issues the Apply event to its snap-in item immediately after it completes the custom Apply handler. The snap-in extension at that point may destroy the document, and will do so in certain circumstances (such as new item creation).

 

[!Important]
Do not write to the XML document unless an apply has occurred. Group Policy preferences will consider the document as unchanged unless it receives an apply event, and this event cannot be initiated by the extension to the Applications snap-in.

 

When an Apply event occurs, an extension to the Applications snap-in can:

Because the Applications snap-in uses MSXML for storage and retrieval of configuration data, an extension to the Applications snap-in must also use MSXML. The full code example for writing an extension to the Applications snap-in uses some basic MSXML utility functions.