Main Table of Contents


Table of Contents

class PtILockBytes
PtILockBytes: class summary
PtILockBytes::PtILockBytes()
PtILockBytes::~PtILockBytes()
PtILockBytes::AddRef()
PtILockBytes::Flush()
PtILockBytes::LockRegion()
PtILockBytes::QueryInterface()
PtILockBytes::ReadAt()
PtILockBytes::Release()
PtILockBytes::SetSize()
PtILockBytes::Stat()
PtILockBytes::UnlockRegion()
PtILockBytes::WriteAt()

class PtILockBytes


Intro
PtILockBytes: class summary
PtILockBytes::PtILockBytes()
PtILockBytes::~PtILockBytes()
PtILockBytes::AddRef()
PtILockBytes::Flush()
PtILockBytes::LockRegion()
PtILockBytes::QueryInterface()
PtILockBytes::ReadAt()
PtILockBytes::Release()
PtILockBytes::SetSize()
PtILockBytes::Stat()
PtILockBytes::UnlockRegion()
PtILockBytes::WriteAt()

PtILockBytes is an implementation of the ILockBytes interface, which is part of Microsoft's OLE specification. To OLE, a LockBytes represents linear sequence of bytes. When you use the LockBytes interface to POET, OLE applications can write to the database just as they would normally write to the hard disk.

Each function in PtILockBytes is simply an implementation of the corresponding function in the standard OLE LockBytes interface, and the parameters generally have meaning for OLE, not for POET. This need not bother you since these functions will be called by the programs which actually create and manipulate the objects themselves- if you are writing a program which stores OLE objects in the database, all you have to do is create the storage and make it available to other programs. The following code shows how to create a compound file on a PtILockBytes in a POET database:

// Create a PtOLEStorage and assign it to the database
PtOLEStorage *myDoc = new PtOLEStorage();
myDoc->Assign (myBase);
// Create a PtLockBytes for the PtOLEStorage to use
m_pLockBytes = new PtILockBytes(myDoc);
myDoc->Forget();
// Create the doc file using the PtLockBytes
hr=StgCreateDocfileOnILockBytes(m_pLockBytes,dwMode|STGM_CREATE, 0, &pIStorage);

PtILockBytes: class summary


Intro

Files to include Class declaration Base class
poet.hxx ole2.h ptlbimp.hxx ptlbimp.hxx ILockBytes

Member functions:

constructor PtILockBytes(PtOLEStorage* );
destructor ~PtILockBytes();
AddRef STDMETHODIMP_(ULONG) AddRef();
Flush STDMETHODIMP Flush();
LockRegion STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset,ULARGE_INTEGER cb,DWORD dwLockType);
QueryInterface STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
ReadAt STDMETHODIMP ReadAt(ULARGE_INTEGER ulOffset,VOID HUGEP* pv,ULONG cb,ULONG FAR* pcbRead);
Release STDMETHODIMP_(ULONG) Release();
SetSize STDMETHODIMP SetSize(ULARGE_INTEGER cb);
Stat STDMETHODIMP Stat(STATSTG FAR* pstatstg, DWORD grfStatFlag);
UnlockRegion STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset,ULARGE_INTEGER cb,DWORD dwLockType);
WriteAt STDMETHODIMP WriteAt(ULARGE_INTEGER ulOffset,VOID const HUGEP* pv,ULONG cb,ULONG FAR* pcbWritten);

PtILockBytes::PtILockBytes()


Intro

Declaration:

PtILockBytes::PtILockBytes(PtOLEStorage* )

Description:

Constructor. Requires a pointer to a PtOLEStorage.


PtILockBytes::~PtILockBytes()


Intro

Declaration:

PtILockBytes::~PtILockBytes()

Description:

Destructor.


PtILockBytes::AddRef()


Intro

Declaration:

STDMETHODIMP_(ULONG) PtILockBytes::AddRef()

Description:

OLE uses link counts much like POET does, and AddRef() is equivalent to POET's Remember() function. When you add a reference to an object you should call AddRef() to increment the link count for the referenced object.


PtILockBytes::Flush()


Intro

Declaration:

STDMETHODIMP PtILockBytes::Flush()

Description:

Writes all internal buffers to the database.


PtILockBytes::LockRegion()


Intro

Declaration:

STDMETHODIMP PtILockBytes::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)

Description:

Locks a range of bytes. POET locks clusters, not individual bytes, so it may lock more than you specify in the parameter list.

Parameters:

ULARGE_INTEGER libOffset Starting address.
ULARGE_INTEGER cb "count bytes" - the number of bytes to lock
DWORD dwLockType OLE Lock type.

PtILockBytes::QueryInterface()


Intro

Declaration:

STDMETHODIMP PtILockBytes::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)

Description:

Reports which operations are supported on this LockBytes implementation.


PtILockBytes::ReadAt()


Intro

Declaration:

STDMETHODIMP PtILockBytes::ReadAt(ULARGE_INTEGER ulOffset,VOID HUGEP* pv,ULONG cb,ULONG FAR* pcbRead)

Description:

Reads a series of bytes from the location. If not all bytes can be read, reads as many bytes as possible.

Parameters:

ULARGE_INTEGER ulOffset Starting address for the read.
VOID HUGEP *pv Address to copy the read data into.
ULONG cb "count bytes" - the number of bytes to read.
ULONG FAR *pcbRead If this pointer is non-zero, writes the number of bytes actually read into this location.

PtILockBytes::Release()


Intro

Declaration:

STDMETHODIMP_(ULONG) PtILockBytes::Release()

Description:

Decrements the link count. This is equivalent to POET's Forget() function.


PtILockBytes::SetSize()


Intro

Declaration:

STDMETHODIMP PtILockBytes::SetSize(ULARGE_INTEGER cb)

Description:

Sets the size of the LockBytes to the number of bytes specified in cb.


PtILockBytes::Stat()


Intro

Declaration:

STDMETHODIMP PtILockBytes::Stat(STATSTG FAR* pstatstg, DWORD grfStatFlag)

Description:

Fills a STATSTG structure with information about the LockBytes.


PtILockBytes::UnlockRegion()


Intro

Declaration:

STDMETHODIMP PtILockBytes::UnlockRegion(ULARGE_INTEGER libOffset,ULARGE_INTEGER cb,DWORD dwLockType)

Description:

Unlocks a range of bytes. POET locks clusters, not individual bytes, so it may unlock more than you specify in the parameter list.

Parameters:

ULARGE_INTEGER libOffset Starting address.
ULARGE_INTEGER cb "count bytes" - the number of bytes to unlock
DWORD dwLockType OLE Lock type.

PtILockBytes::WriteAt()


Intro

Declaration:

STDMETHODIMP PtILockBytes::WriteAt(ULARGE_INTEGER ulOffset,VOID const HUGEP* pv,ULONG cb,ULONG FAR* pcbWritten)

Description:

Writes a series of bytes. If not all bytes can be written, writes as many bytes as possible.

Parameters:

ULARGE_INTEGER ulOffset Starting address to write at.
VOID HUGEP *pv Pointer to the data which should be written.
ULONG cb "count bytes" - the number of bytes to write.
ULONG FAR *pcbWritten If this pointer is non-zero, writes the number of bytes actually written.

Copyright (c) 1996 POET Software, Inc. All rights reserved. Reproduction in whole or in part in any form or medium without the express permission of POET Software, Inc. is prohibited.