Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Memory to IStream
Author:Arkon
Category:Win32API
File Size:304 Bytes
Uploaded at:19-Aug-06 10:31:39 am
Description:
  Sometimes you encounter functions which require an IStream instead of raw data. This snippet will show you how to convert raw data into an IStream.
  
IStream* pStream = NULL;
char buf[] = "hello IStream";
HGLOBAL hBlock = GlobalAlloc(PTR, sizeof(buf));
if (hBlock == NULL) // err
if (SUCCEEDED(CreateStreamOnHGlobal(hBlock, FALSE, &pStream)) {
 // Do something with pStream

 // Release
 pStream->Release();
}
// Free block
GlobalFree(hBlock);
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[117321]
2D Rotated Rectangles Collision Detection[89239]
Keyboard Hook[77504]
UDP[65927]
HTTP Proxy[41366]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11566]
PS2 Mouse Driver[6963]
Wave Format Player[5796]
Reading FAT12[5622]
CodeGuru[5362]


All rights reserved to RageStorm © 2009