I am trying to take a screenshot of the whole screen and would like to send it over the network to a server. (the server will be the one to save it)
I am currently using this code
HBITMAP hBitmap = CreateCompatibleBitmap(hScreen, w, h);
CImage image;
image.Attach(hBitmap);
image.Save(L"screen.jpg");
It does save the file, but that's not what I want. I'm also not sure how to get the bytes, I was thinking of GetBits()
but the documentation says it is a pointer to the data of the underlying Bitmap.
What I want to get is the JPG data which I can send through the network and save the image using the server.
So, why am I not just using bitmap and sending it directly? because it is a bit complicated and the code was quite long, you'll have to get the header and stuff. I could be wrong though.
My question:
- How do I get the bytes from the image so I can send it to the server? (like a BLOB to save to the database)
- Any library that can help me convert and get bytes all in memory?
references:
https://msdn.microsoft.com/en-us/library/ms535406(v=VS.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms535406(v=vs.85).aspx
http://www.codeproject.com/Tips/738533/save-load-image-between-buffer