本文介绍了使用PrintWindow API捕获用户区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好..



我有一个窗口句柄(hwnd)。我想截取这个窗口的截图,我已经使用了PrintWindow这样:



Hello..

Am having a window handle(hwnd). I want to take Screenshot of this window, I have used PrintWindow for this like this:

void Screenshot()
{
  CImage image;
  image.Create(imageWidth, imageHeight, 24);
  CImageDC imageDC(image);

  HWND hwnd = ::FindWindow(0,"MyWindow");

  PrintWindow(hwnd, imageDC, PW_CLIENTONLY);

  image.Save("H:\\Image.bmp",ImageFormatBMP);
}





使用此代码,我在H:\\ drive中获取指定的窗口图像。现在我的问题是:我如何使用用户指定的区域截取MyWindow的屏幕截图,即通过指定x轴和& y轴。我的意思是,我不想要MyWindow的整个图像,我只需要指定MyWindow的区域,即MyWindow中间的某个区域。

所以我如何指定x& y坐标到PrintWindow。另外。我试过BitBlt& StretchBlt但它们比PrintWindow慢。

请有人知道如何完成这个。



谢谢大家:)



With this code i get the specified window image in H:\\ drive. Now my question is : How do i take a screenshot of MyWindow with user specified area i.e., by specifying x-axis & y-axis. I mean, i don''t want the entire image of MyWindow, I need only specified area of MyWindow i.e., Somewhere in the middle of MyWindow.
So How do i specify x & y coordinates to PrintWindow. Alternatively. i have tried with BitBlt & StretchBlt but they are relatively slower than PrintWindow.
Please someone can tell how to accomplish this.

Thank you all :)

推荐答案


这篇关于使用PrintWindow API捕获用户区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 17:56