Click to return to the Component Development home page    
IObjectWithSite::SetSite ...     IPersistHistory::GetPosit...     Component Interface Refer...    
Web Workshop  |  Component Development

IPersistHistory Interface


The IPersistHistory interface provides a mechanism for a component to persist its state within its containing application during the current session.

IPersistHistory Methods

GetPositionCookie Reserved for future use. Components are not required to implement this method.
LoadHistory Restores the state of the component.
SaveHistory Saves the state of a component.
SetPositionCookie Reserved for future use. Components are not required to implement this method.

Interface Information

Implementation Custom
Inherits from IPersist
Header and IDL files Perhist.h; Perhist.idl
Minimum availability Internet Explorer 4.0
Minimum operating systems Windows 95, Windows NT 4.0

Remarks

This interface is implemented by a component to maintain its state across navigations in a Web browser. For example, a user enters data into a Web-based form containing intrinsic controls as well as a custom edit control. The user navigates away from the page and later returns during the current browser session to find that the data entered into the custom component is lost, while the intrinsic controls have maintained their state.

In Internet Explorer 4.0 and later, when a user navigates away from a page, all controls on the page are queried for IPersistHistory. Those that implement the interface are handed a stream through the SaveHistory method, in which they can store their current state. If the page is loaded again during the current browser session, each control is handed a stream through the LoadHistory method from which they can reload their previous state.

Internet Explorer 4.0 and later caches up to 2 MB of persistent data for all controls. When this limit is exceeded, the least recently used data is discarded. Component developers should respect the needs of other controls and limit their use of the history cache.

This interface replaces the four-page cache implemented by Internet Explorer 3.0x.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.