How can I exclude my own flicker-free window when I take a screenshot?
We have a Delphi based application that grabs the desktop via GDI. The only problem is that the application window is also being captured during the process, which we want to avoid.
We tried to resolve it by hiding and showing the application window before and after the grab operation, however this results in severe flickering.
Any other methods will be needed to help solve this problem.
source to share
You can solve this problem by using the window enlargement feature. You can exclude or include any windows ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms692402%28v=vs.85%29.aspx ). This way you can get a screenshot of the screen except for windows that you don't need. This approach will work on Windows and later on XP (7, vista, 8);
source to share
If you want to take a screenshot of the entire desktop and without your application window, I believe there are two options.
-
As you already found out, you must hide your applications window before taking a screenshot. Now minimizing and maximizing your application is not great because of the minimization / maximization effects. So you can try to get it out of the visible area, or perhaps turn on alpha transparency and temporarily set it to 0 (completely transparent).
-
Another approach is to list all visible windows, take a screenshot for each specific window, and then compile the final screenshot by posting screenshots of the individual windows, placing them in the correct position. Now, the main benefit of this approach is that you can exclude any window you want, it could even be the window of some other application that you have no control over. But the main disadvantage of this approach is that it is much slower and requires much more memory.
source to share