Print Screen

orcus85

New member
Joined
Jun 15, 2007
Messages
4
Programming Experience
5-10
We want to be able to printScreen a window inside
a timer control several times a second, we have a VB.NET
project ,which we have attached, which does this
using PrintWindow() function in windows API. We need
to use this API function since it allows us to
printscreen a window EVEN when it is covered
by another window and it is fast enough.

However there is a problem, when we take many
printscreens the window that is being captured, it
stops being painted or displayed propperly, and
regions inside that window are not refreshed.

We have attached a small VB.NET 2005 project
which allows you to reproduce the problem by
simply selecting a window which is often refreshed
(like a webbrowser window, or a small game)
and start capturing. You will after some time
see that the window stops being painted.

We request a VB.NET solution to this problem,
or alternativley a code
which is fast and able to printscreen a window by
its handle EVEN when it is covered completley (not
minimized).

NOTE:
GraphicsInstance.CopyFromScreen() doesnt work on
covered windows
 

Attachments

  • SimplePrintScreenProblem.zip
    16.3 KB · Views: 34
There is a simple refresh command built into every control and this alone may do the trick. But the other command that you may want to use in conjunction wit the refresh command is Application.DoEvents.

This will allow everything to catch up. This may slow things down a little bit. This is what I have always used for counters, etc. when I was incrementing a lable and a progress bar. This would make things look much smoother while the application was running.

Try a couple of those around the area in the code where you are resizing the form.

Application.DoEvents alone may fix the problem in the subroutine where you are resizing the form. If it does not maybe try the refresh command, or try refreshing the picture box and do events there.


Steve
 
Back
Top