Jump to content

WpSaveLong: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
Line 6: Line 6:


==Parameters==
==Parameters==
;''somSelf'' ([[WPObject]] *) - input
;''somSelf'' (WPObject *) - input:Pointer to the object on which the method is being invoked.
:Pointer to the object on which the method is being invoked.
:Points to an object of class [[WPObject]].
:Points to an object of class [[WPObject]].
 
;''pszClass'' ([[PSZ]]) - input:Pointer to the class name.
;''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.
: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.
;''ulKey'' ([[ULONG]]) - input
:Class-defined identifier.
:A class-defined identifier that correlates to a particular instance data variable.
:A class-defined identifier that correlates to a particular instance data variable.
 
;''ulValue'' (ULONG) - input:Value (ULONG) to be stored.
;''ulValue'' ([[ULONG]]) - input
:Value ([[ULONG]]) to be stored.


==Returns==
==Returns==
;''rc'' ([[BOOL]]) - returns
;''rc'' ([[BOOL]]) - returns:Success indicator.
:Success indicator.
::TRUE: Successful completion.
::TRUE: Successful completion.
::FALSE: Error occurred.
::FALSE: Error occurred.
Line 77: Line 69:
* [[wpSaveState]]
* [[wpSaveState]]
* [[wpSaveString]]
* [[wpSaveString]]


[[Category:Workplace Instance Methods]]
[[Category:Workplace Instance Methods]]

Latest revision as of 22:55, 16 November 2025

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.
ulValue (ULONG) - input
Value (ULONG) to be stored.

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

Related Methods