I am writing a program that requires repeatedly capturing the contents of the screen.
The way I have it done now:
Using a timer, it captures the screen into a variable. The variable is declared everytime the timer executes so the variable becomes empty. However, after running it for a few minutes it begins draining system resources until the computer freezes. If I close it before it freezes, the resources don't have back, they're just gone. I have to restart.
So does anyone know a different way of doing a screen capture that won't drain resources if done a few thousand times?
The way I have it done now:
Using a timer, it captures the screen into a variable. The variable is declared everytime the timer executes so the variable becomes empty. However, after running it for a few minutes it begins draining system resources until the computer freezes. If I close it before it freezes, the resources don't have back, they're just gone. I have to restart.
So does anyone know a different way of doing a screen capture that won't drain resources if done a few thousand times?
-
Re: ScreenCapture?
Fri, September 10, 2004 - 7:22 AM1)I don't know how you are capturing the screen, but if you are using the clipboard in any way, maybe you are just filling it up and need to clear it periodically?
2) Try a "set variablename = nothing" before you exit the screen grab procedure. That will force (in theory) vb to disassociate itself with the variable and clean up memory.
3) I have been doing some work with writing a universal "print screen" menu that will do a screen grab on the active form and then dumps it into a picturebox control. This is the MS knowledge base item I was using. There may be some methods here you can exploit--
support.microsoft.com/default.aspx
4) This is an ugly solution but it may suffice if nothing else works:
Write one *.exe application that is your screen capture application. When launched, its sole purpose in life is to capture the screen, save to whatever medium you are using, then the application terminates. Terminating the application should force a resource cleanup that sometimes doesn't happen if it stays open.
Write a second application that is nothing more than the timer control. Every time the timer event is triggered it issues a shell() command to call your screen capture *.exe. -
-
Re: ScreenCapture?
Sat, September 11, 2004 - 3:58 PMThanks, I'll try these. Hopefully it should solve the problem.
-