wpRestoreLong
Appearance
This instance method is called to allow the object to restore a 32-bit instance data value.
Syntax
_wpRestoreLong(somSelf, pszClass, ulKey, pulValue)
Parameters
- somSelf (WPObject *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPObject.
- pszClass (PSZ) - input
- Pointer to the class name.
- A pointer to a zero-terminated string which contains any unique string. The class name is recommended but not enforced.
- ulKey (ULONG) - input
- Class-defined identifier.
- A class-defined identifier that correlates to a particular instance data variable.
- pulValue (PULONG) - output
- The address of the long value.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion.
- FALSE: Error occurred.
Remarks
This method restores a 32-bit data value that was saved by a call to wpSaveLong.
Usage
This method can be called only during the processing of the wpRestoreState method.
How to Override
This method is generally not overridden.
Example Code
Declaration:
#define INCL_WINWORKPLACE #include <os2.h> WPObject somSelf; / Pointer to the object on which the method is being invoked. / PSZ pszClass; / Pointer to the class name. / ULONG ulKey; / Class-defined identifier. / PULONG pulValue; / The address of the long value. / BOOL rc; / Success indicator. */ rc = _wpRestoreLong(somSelf, pszClass, ulKey, pulValue);
This example demonstrates override of wpRestoreState to save and restore a ULONG.
SOM_Scope BOOL SOMLINK wpRestoreState(LockBox somSelf, ULONG ulReserved) { ULONG ulSecretCode; / Secret code / BOOL fSuccess; / Success or failure flag */ LockBoxData *somThis = LockBoxGetData(somSelf); LockBoxMethodDebug("LockBox","wpRestoreState"); fSuccess = _wpRestoreLong ( somSelf /* Pointer to thy self */ , "LockBox" /* Class name */ , LOCKBOX_KEY_SECRET /* Key of data to get */ , &ulSecretCode ); /* Data returned here */ if ( !fSuccess ) { ulSecretCode = 0L; /* On first restore, make secret code 0 */ /* save initial code to OS2.INI file */ _wpSaveLong ( somSelf /* Pointer to me */ , "LockBox" /* Class name */ , LOCKBOX_KEY_SECRET /* Key of data */ , ulSecretCode ); /* Data */ } return (parent_wpRestoreState(somSelf,ulReserved)); }