I am trying to capture the screen,then transfer it to byte stream, in order to send it to the network.
But the stream->Read()
doesn’t work.The once_read always 0, and the there is not data on buf. I don’t konw if there are better ways to do this.
<code>
// there a trouble here.
while (size > 0)
{
// IStream* stream;
// CreateStreamOnHGlobal(0, true, &stream);
HRESULT res = stream->Read(buf, min(size, 4095), (ULONG *)&once_read);
std::cout << buf << std::endl;
size -= once_read;
}
</code>
<code>
// there a trouble here.
while (size > 0)
{
// IStream* stream;
// CreateStreamOnHGlobal(0, true, &stream);
HRESULT res = stream->Read(buf, min(size, 4095), (ULONG *)&once_read);
std::cout << buf << std::endl;
size -= once_read;
}
</code>
// there a trouble here.
while (size > 0)
{
// IStream* stream;
// CreateStreamOnHGlobal(0, true, &stream);
HRESULT res = stream->Read(buf, min(size, 4095), (ULONG *)&once_read);
std::cout << buf << std::endl;
size -= once_read;
}
I want to know how to transfer a CImage
to a byte array, then use send()
to send it to the network.
New contributor
loverinmydream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.