CreateILockBytesOnHGlobal
Returns an OLE-provided implementation of the
ILockBytes interface which allows you to build a storage object in memory.
HRESULT CreateILockBytesOnHGlobal(
HGLOBAL hGlobal,
| //Memory handle for the byte array object
|
BOOL fDeleteOnRelease,
| //Indicates whether to free memory when the object is released
|
ILockBytes ** ppLkbyt
| //Points to location for pointer to the new byte array object
|
);
|
|
Parameters
hGlobal
Contains the memory handle allocated by the
GlobalAlloc function. The handle must be allocated as moveable and nondiscardable. If the
handle is to be shared between processes, it must also be allocated as shared.
New handles should be allocated with a size of zero. If
hGlobal is NULL, the
CreateILockBytesOnHGlobal function internally allocates a new shared memory block of size zero.
fDeleteOnRelease
Indicates whether the underlying handle for this byte array object should be
automatically freed when the object is released.
ppLkbyt
Points to the location where this method places the pointer for the new byte
array object, that is, the new instance of the
ILockBytes interface.
Return Values
S_OK
Indicates the
ILockBytes instance was created successfully.
E_INVALIDARG
Indicates an invalid value was specified for the
hGlobal parameter
.
E_OUTOFMEMORY
Indicates not enough memory to create an
ILockBytes instance.
Comments
This function creates a byte array object in memory using the OLE-provided
implementation of the
ILockBytes interface. The returned byte array object can be the basis for a compound
file. You can call the
StgCreateDocfileOnILockBytes function to build a compound file on top of this byte array object. The
ILockBytes instance calls the
GlobalReAlloc function to grow the memory block as needed.
The current contents of the memory block are undisturbed by the creation of
the new byte array object. After creating the
ILockBytes instance, you can use the
StgOpenStorageOnILockBytes function to reopen a previously existing storage object already contained in
the memory block.
Note If you free the
hGlobal memory handle, the byte array object is no longer valid. You must call the
ILockBytes::Release method before freeing the memory handle.
The value of the
hGlobal parameter can be changed by a subsequent call to the
GlobalReAlloc function; thus, you cannot rely on this value after the byte array object is
created.
See Also
StgOpenStorageOnILockBytes
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database