|
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
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|