does anyone know how to get a screen shot as a png file (under MFC, C++)
i am able to get screen shot as a HBITMAP. I have converted it to device independent bits (DIB) but i dont know how to convert these bits to png in memory.
I am aware i can use CImage to save the hbitmap as a png:
but i really dont wanna do this as the png file will be sent over the network (thus saving it on disk will not be such good idea).
any ideas will be welcome,
Last edited on
Off the top of my head, there is a an overloaded CImage::Save that takes a stream, could you create a memory stream and save the CImage to that?
thanks Grey Wolf.....that works!
yep, im creating a stream object using CreateStreamOnHGlobal() and then using the overloaded CImage::Save :D
hres = CreateStreamOnHGlobal ( 0 , TRUE , &pStream );
hr = myImage.Save(pStream, Gdiplus::ImageFormatPNG);