我如何复制窗口的视觉内容,并把它放在win32 c ++的新窗口? [英] How can i copy the visual content of a window and put it on a new window in win32 c++?
本文介绍了我如何复制窗口的视觉内容,并把它放在win32 c ++的新窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我读了一些关于GetDIBits或BitBlt,但我不明白他们。
I've read something about GetDIBits or BitBlt but i do not understand them.
这可能是因为我不明白Windows如何实际处理窗口上的图形。这将是完美的,如果有人可以引用我到一个页面,我可以了解这些事情! :)
That could be because i don't understand how Windows actually handles graphics on windows. It would be perfect if someone could refer me to a page where i could learn about these things! :)
推荐答案
我在Windows WM_PAINT中使用这个代码解决了问题。现在显示与目标窗口完全相同的内容。
I solved the problem using this code in the windows WM_PAINT. It now shows the exact same content as the target window.
PAINTSTRUCT ps;
HDC hdc = BeginPaint(MainWindow, &ps);
HDC TargetDC = GetDC(TargetWindow);
RECT rect;
GetWindowRect(TargetWindow, &rect);
BitBlt(hdc,0,0,rect.right-rect.left,rect.bottom-rect.top,TargetDC,0,0,SRCCOPY);
EndPaint(MainWindow, &ps);
这篇关于我如何复制窗口的视觉内容,并把它放在win32 c ++的新窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文