将屏幕截图 (Bitblt) 存储在内存缓冲区中以通过 IdTCPClient 发送
在 Windows Vista 上的 C++ builder 6 中...
Graphics:: TBitmap * bmpscreencapture = new Graphics::TBitmap;
bmpscreencapture-> Height = Screen-> Height;
bmpscreencapture-> Width = Screen-> Width;
HDC ScreenSrc = GetWindowDC (0);
BitBlt (bmpscreencapture-> Canvas-> Handle, 0, 0, Screen-> Width,
Screen-> Height, ScreenSrc, 0, 0, SRCCOPY);
Canvas->Draw(10, 10, bmpscreencapture);
ReleaseDC (GetDesktopWindow (), ScreenSrc);
delete bmpscreencapture;
我目前有一段代码用于捕获屏幕并将屏幕捕获显示到空表单上。 我想做的是将捕获的图像存储到内存缓冲区中,然后使用 indy 客户端 IdTCPClient 通过互联网发送该缓冲区,以便使用 indy 服务器 IDTCPServer 的类似程序接收。
有没有人对如何实现这一目标有任何建议/想法? 我对图形编程相当陌生
In c++ builder 6 on windows vista ...
Graphics:: TBitmap * bmpscreencapture = new Graphics::TBitmap;
bmpscreencapture-> Height = Screen-> Height;
bmpscreencapture-> Width = Screen-> Width;
HDC ScreenSrc = GetWindowDC (0);
BitBlt (bmpscreencapture-> Canvas-> Handle, 0, 0, Screen-> Width,
Screen-> Height, ScreenSrc, 0, 0, SRCCOPY);
Canvas->Draw(10, 10, bmpscreencapture);
ReleaseDC (GetDesktopWindow (), ScreenSrc);
delete bmpscreencapture;
I currently have a section of code for capturing the screen and displaying the screen capture onto an empty form. What I would like to do is store the captured image into a memory buffer and then send this buffer over the internet using the indy client IdTCPClient to be received by a similar program using indy server IDTCPServer.
Has anyone got any suggestions/ideas of how to accomplish this?? I am fairly new to graphics programming
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 TBitmap::SaveToStream() 方法将数据保存到 TStream,例如 TMemoryStream。 然后将 TStream 传递给 Indy 的 TIdTCPConnection::WriteStream() (Indy 9 及更早版本)或 TIdIOHandler::Write(TStream) (Indy 10) 方法。 在接收端,您可以使用 TIdTCPConnection/TIdIOHandler::ReadStream() 方法将数据读入 TStream,然后将 TStream 传递给 TBitmap::LoadFromStream() 方法。
Use the TBitmap::SaveToStream() method to save the data to a TStream, such as a TMemoryStream. Then pass the TStream to Indy's TIdTCPConnection::WriteStream() (Indy 9 and earlier) or TIdIOHandler::Write(TStream) (Indy 10) method. On the recieving end, you can then use the TIdTCPConnection/TIdIOHandler::ReadStream() method to read the data into a TStream, and then pass the TStream to the TBitmap::LoadFromStream() method.