|
CreateStreamOnHGlobal
Returns an OLE-provided implementation of the IStream interface with the stream object stored in global memory.
HRESULT CreateStreamOnHGlobal(
HGLOBAL hGlobal,
| //Memory handle for the stream object
| BOOL fDeleteOnRelease,
| //Indicates whether to free memory when the object is released
| LPSTREAM * ppstm
| //Points to location for pointer to the new stream 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 CreateStreamOnHGlobal function internally allocates a new shared memory block of size zero.
fDeleteOnRelease
Indicates whether the underlying handle for this stream object should be
automatically freed when the stream object is released.
ppstm
Points to the location where this method places a pointer to the new stream
object, that is, the new IStream instance. It cannot be NULL.
Return Values
S_OK
Indicates the stream object was created successfully.
E_OUTOFMEMORY
Indicates the stream could not be created due to lack of memory.
E_INVALIDARG
Indicates invalid value for one of the parameters.
Comments
This function creates a stream object in memory using the OLE-provided
implementation of the IStream interface. The returned stream object supports both reading and writing, is
not transacted, and does not support locking.
The initial contents of the stream are the current contents of the memory
block provided in the hGlobal parameter. If the hGlobal paramter is NULL, this function internally allocates memory.
The current contents of the memory block are undisturbed by the creation of
the new stream object. Thus, you can use this function to open an existing stream
in memory.
The initial size of the stream is the size of the memory handle returned by
the Win32 GlobalSize function. Because of rounding, this is not necessarily the same size that was
originally allocated for the handle. If the logical size of the stream is
important, you should follow the call to this function with a call to the IStream::SetSize method.
See Also
CreateStreamOnHGlobal, IStream::SetSize
GlobalSize in Win32
Related LinksSoftware for Delphi and C++ Builder developers Software for Visual Studio .NET developers Software for Visual Basic 6 developers Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps Win32 Programmer's Reference (win32.hlp) Win32 Multimedia Programmer's Reference (mmedia.hlp) Microsoft Windows Pen API Programmer's Reference (penapi.hlp) Microsoft Windows Sockets 2 Reference (sock2.hlp) Microsoft Windows Telephony API (TAPI) Programmer's Reference (sock2.hlp) Unix Manual Pages
|