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:
Files to include | Class declaration | Base class |
poet.hxx ole2.h ptlbimp.hxx | ptlbimp.hxx | ILockBytes |
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(PtOLEStorage* )
Constructor. Requires a pointer to a PtOLEStorage.
- PtILockBytes::~PtILockBytes()
- STDMETHODIMP_(ULONG) PtILockBytes::AddRef()
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.
- STDMETHODIMP PtILockBytes::Flush()
Writes all internal buffers to the database.
- STDMETHODIMP PtILockBytes::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Locks a range of bytes. POET locks clusters, not individual bytes, so it may lock more than you specify in the parameter list.
ULARGE_INTEGER libOffset | Starting address. |
ULARGE_INTEGER cb | "count bytes" - the number of bytes to lock |
DWORD dwLockType | OLE Lock type. |
- STDMETHODIMP PtILockBytes::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
Reports which operations are supported on this LockBytes implementation.
- STDMETHODIMP PtILockBytes::ReadAt(ULARGE_INTEGER ulOffset,VOID HUGEP* pv,ULONG cb,ULONG FAR* pcbRead)
Reads a series of bytes from the location. If not all bytes can be read, reads as many bytes as possible.
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. |
- STDMETHODIMP_(ULONG) PtILockBytes::Release()
Decrements the link count. This is equivalent to POET's Forget() function.
- STDMETHODIMP PtILockBytes::SetSize(ULARGE_INTEGER cb)
Sets the size of the LockBytes to the number of bytes specified in cb.
- STDMETHODIMP PtILockBytes::Stat(STATSTG FAR* pstatstg, DWORD grfStatFlag)
Fills a STATSTG structure with information about the LockBytes.
- STDMETHODIMP PtILockBytes::UnlockRegion(ULARGE_INTEGER libOffset,ULARGE_INTEGER cb,DWORD dwLockType)
Unlocks a range of bytes. POET locks clusters, not individual bytes, so it may unlock more than you specify in the parameter list.
ULARGE_INTEGER libOffset | Starting address. |
ULARGE_INTEGER cb | "count bytes" - the number of bytes to unlock |
DWORD dwLockType | OLE Lock type. |
- STDMETHODIMP PtILockBytes::WriteAt(ULARGE_INTEGER ulOffset,VOID const HUGEP* pv,ULONG cb,ULONG FAR* pcbWritten)
Writes a series of bytes. If not all bytes can be written, writes as many bytes as possible.
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.