wpSaveLong
Appearance
This instance method is called to allow the object to save a 32-bit instance data value.
Syntax
_wpSaveLong(somSelf, pszClass, ulKey, ulValue)
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 that 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.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion.
- FALSE: Error occurred.
Remarks
The saved 32-bit data value can be restored by issuing a call to wpRestoreLong.
Usage
This method can be called only during the processing of the wpSaveState method.
How to Override
This method is generally not overridden.
Example Code
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)); }