The IPersistHistory InterfaceThe IPersistHistory Interface*
*Contents  *Index  *Topic Contents
*Previous Topic: IErrorLog::AddError
*Next Topic: IPersistHistory::SaveHistory

The IPersistHistory Interface

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);
}

When to Implement

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.

Historical Note

This interface replaces the four-page cache implemented by Internet Explorer 3.0x; Internet Explorer 4.0 does not implement the four-page cache.

arrowg.gifIPersistHistory::SaveHistory

arrowg.gifIPersistHistory::LoadHistory

arrowg.gifIPersistHistory::SetPositionCookie

arrowg.gifIPersistHistory::GetPositionCookie


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.