Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
Samples
|
Component DevelopmentPercy Sample |
||||
Download sample | ||||
Description
Percy is an ATL2.0 control that demonstrates the use of IPersistHistory, so that state can be retained if the page containing the control is returned to using the back button.
More Details
Percy is a subclassed edit control. Having built the control, load percyctl.htm into a browser to see it work. On navigation away from the page, IPersistHistory::SaveHistory() is called, supplying a stream into which data should be saved. On return IPersistHistory::LoadHistory() is called so that state can be reloaded.
Note: Only nineteen bytes of data are loaded in the LoadHistory implementation of Percy to load into a temporary buffer.
Percy also implements IObjectSafety specifically to allow IPersistHistory to be used without any security warning dialogs, as Percy is a safe control.
The Percy sample will compile and run on Win32 platforms with Internet Explorer 4 or Internet Explorer 5.
NOTE: Due to an incompatibility between VC 6.0 ATL and the NT 5.0 beta headers, you should not include the Internet Explorer 5.0 Beta headers and libraries nor the Windows NT 5.0 beta headers and libraries in your include or libpath.
For example, if you installed the SBN headers and libraries under root directory "C:\SBN" and you installed Visual C++ in the "C:\Program Files\Microsoft Visual Studio\VC98" directory, in Visual C++ your global directory options (Tools->Options->Directories tab) for your Include Files should resemble the following:
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE
This is different from any of the non-ATL samples in the Samples Gallery, all of which require the SBN path and the NT50 path to be added to the directory list.