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


[Back: wpRestoreLong - Related Methods]
[Next: wpRestoreLong - Topics]