Size of memory pointed to by void * pointer.
-
You could use _msize()[^]. For instance,
#include "malloc.h"
...
// Allocate 100 bytes.
void* pPointer = new BYTE[100];// Get the size from void ptr. Remember, It will return size in bytes.
int size = _msize( Ptr );Please note that it won't work if the memory is allocated in stack. Only for memory allocated on heap. Hope it helps. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
You could use _msize()[^]. For instance,
#include "malloc.h"
...
// Allocate 100 bytes.
void* pPointer = new BYTE[100];// Get the size from void ptr. Remember, It will return size in bytes.
int size = _msize( Ptr );Please note that it won't work if the memory is allocated in stack. Only for memory allocated on heap. Hope it helps. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
Ah! Now i got the context about what you're trying to do. Export the BITMAP to XML? Bravo! i'd say. ;) IMHO, Instead of dumping the BITMAP structure to XML, just get the bitmap data by calling GetBitmapBits()[^] and other necessary information such as width, height, color depth and save that to XML file. Later on by loading these values, you can recreate the bitmap by calling the function - CreateBitmap()[^]. Hope this helps you. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
Ah! Now i got the context about what you're trying to do. Export the BITMAP to XML? Bravo! i'd say. ;) IMHO, Instead of dumping the BITMAP structure to XML, just get the bitmap data by calling GetBitmapBits()[^] and other necessary information such as width, height, color depth and save that to XML file. Later on by loading these values, you can recreate the bitmap by calling the function - CreateBitmap()[^]. Hope this helps you. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.