Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

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.

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!

Back to topBack to top

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

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site