Save memory DC to file
I am drawing to a memory DC and I need to save it as BMP file... what is the function for this?
Thanks
There's no Win32 function to do that unfortunately (Like LoadImage()), but there's plenty of code samples to do that on Google. This One looks promising.
hmmm... microsoft could have make it less complicated
Thanks for the link! The code works but leaks somewhere in SaveBMPFile function.
Thanks for the link! The code works but leaks somewhere in SaveBMPFile function.
Quote:Original post by davidcolemanHmm, so it does. You'll need to delete[] lpbi and lpvBits before exiting the function (Which is in all those return 0; cases), or use a std::vector<char> and have them automatically destroyed when they go out of scope (Which is what I'd recommend if you're using C++).
hmmm... microsoft could have make it less complicated
Thanks for the link! The code works but leaks somewhere in SaveBMPFile function.
There are less complicated ways to do it. Ex: use GDI+'s Bitmap::FromHBITMAP to create a Bitmap object and then use the Save() member function to save it to a file.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement