Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
The IPersistHistory interface provides a mechanism for a component to persist its state within its containing application during the current session.
IDL:
[ uuid(91A565C1-E38F-11d0-94BF-00A0C9055CBF), object, pointer_default(unique) ] interface IPersistHistory : IPersist { typedef [unique] IPersistHistory *LPPERSISTHISTORY; HRESULT LoadHistory( [in]IStream *pStream, [in]IBindCtx *pbc); HRESULT SaveHistory( [in]IStream *pStream); HRESULT SetPositionCookie( [in]DWORD dwPositioncookie); HRESULT GetPositionCookie( [out]DWORD *pdwPositioncookie); }
This interface is implemented by a component that wishes to maintain its state across navigations in a Web browser. Take the following 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, 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 into 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.
Warning Internet Explorer 4.0 caches up to 2 MB of persistent data for all controls. When this limit is exceeded, data is discarded on a least recently used basis. 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; Internet Explorer 4.0 does not implement the four-page cache.
IPersistHistory Methods
GetPositionCookie Reserved for future use. Components are not required to implement this method. LoadHistory The container calls this method to request that the component restore its state. SaveHistory The container calls this method to request that the component save its state. SetPositionCookie Reserved for future use. Components are not required to implement this method.
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.