tags:

views:

77

answers:

1

I made a program that opens an application, sleeps the thread for 500ms then takes a picture of the frame's handle. I do this to about 600 files. Oddly enough, every 40 or so files, the process.kill() doesnt work or something, because the application hangs, and the running files program is running, when it should have been killed, then my program crashes when it tries to start the process. On my slow laptop, it crashes every 60 or so, on my fast quadro, every 30 or so. What could cause this? I dont see how a procedure could be skipped; odd....

Thanks

A: 

What happens when you lengthen your timing values? Instead of 500ms, try 2-4 seconds. Additionally, try using WaitForExit so you can detect if the application is hanging.

Charlie Salts
When I lengthen, it still happens, I tried adding the code to stop the proccess more than once, this reduced it but didnt fix it....
Milo
And when you WaitForExit? It's possible that the application you're working with simply can't handle being started and stopped in rapid succession.
Charlie Salts