将屏幕截图 (Bitblt) 存储在内存缓冲区中以通过 IdTCPClient 发送

发布于 2024-08-01 15:09:57 字数 679 浏览 5 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给我一枪 2024-08-08 15:09:57

使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文