OriginObject::Lock

Description

Locks a particular object from read/write data access (Implemented only for WorksheetLayer, WorksheetPage, and Project Objects)

Syntax

BOOL Lock( LPCSTR lpcszPassword, DWORD dwCtrl )

Parameters

lpcszPassword
Desired password to unlock later
dwCtrl
can be one or more of the following bits: PLC_WRITE, PLC_READ, PLC_RENAME

Return

returns non zero if successfull else 0;

Examples

EX1

void wkslock(string strPass = "CP", bool bHideData = false)
{
    Worksheet wks = Project.ActiveLayer();
    DWORD dwBits = PLC_WRITE;
    if(wks)
    {
        if(bHideData)
            dwBits |= PLC_READ;
        wks.Lock(strPass, dwBits);
        printf("Worksheet %s is locked\n", wks.GetName());
    }
}

EX2

void wkslock_rename(bool bLock=true)
{
        Worksheet wks = Project.ActiveLayer();
        if(wks)
        {
                int nn = 0;
                if( bLock )
                        wks.Lock(NULL, PLC_RENAME);
                else
                        wks.Unlock(NULL, 0);
        }
}

Remark

See Also

OriginObject::GetLock, OriginObject::Unlock

header to Include

origin.h