C++ gdi::Bitmap to PNG Image in memory
问题 I'm trying to send a screenshot of a window over tcp to a server. Getting the screenshot is no problem (using GDIplus). The networking is also easy for me. The problem is trying to convert the gdi+ Bitmap to a png (in memory) to get the data out of it and send it to the server. Can anyone help me please? 回答1: Gdiplus can save to file, or save to memory using IStream . See Gdiplus::Image::Save method //get gdi+ bitmap Gdiplus::Bitmap bitmap(hbitmap, nullptr); //write to IStream IStream*