Hello I am a moderately exprienced vb.net programmer and l'm making a
program to capture a screenshot and turn it into a byte array suitable
for sending via a socket connection probably UDP for speed reasons. I
cannot do this with a save to file method as it would leave hundreds
of images behind after the program stopped running (you cannot access
any file that has been saved to using vb.net while the program is
still running which includes deleting or overwriting it!) so I need to
store the image temporarily in program. This is the method i'm using
to convert the image to bytes but I now need to know how big the image
i'm sending is!!
Private Function BmpToBytes_MemStream(ByVal bmp As Bitmap) As Byte()
Dim ms As MemoryStream = New MemoryStream()
' Save to memory using the Jpeg format
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim bmpBytes() As Byte = ms.GetBuffer()
bmp.Dispose()
ms.Close()
Return bmpBytes
End Function
I'm using GDI+ for screen capture, clipboard has a tendency to error.
I will probably need to capture about 100 screenshots a minute!