Page 1 of 1

Snapshot of dialog containing progress bar crashes program

Posted: Mon Mar 09, 2009 11:01 pm
by Dead Composer
I have a Java application that uses SWT for windowing. The application includes several dialogs, some of which contain a progress bar (SWT class: ProgressBar) control. I am automating the application using a C# program which interfaces with the Ranorex library. Whenever I use Ranorex.ElementSnapshot to take a snapshot of a dialog containing a ProgressBar and save the snapshot to a PNG file, the PNG file is created and appears correct, but the Java program immediately crashes. According to the log file, the error is a Java Virtual Machine error (illegal access). One of the frames mentioned in the log file is the ProgressBar window procedure.

If anyone has a clue as to why this happens, please help. Thanks.

Posted: Thu Mar 12, 2009 4:31 pm
by Support Team
I tried to reproduce the crash with the SWT progressbar, but without success.
When exactly does your application crash ?

If you only need a picture of your dialog (and not a snapshot which also includes complete element information) try Imaging.CaptureImage() instead, which should be safe (but does not work with hidden windows)


Michael
Ranorex Team

Posted: Thu Mar 12, 2009 8:43 pm
by Dead Composer
Imaging.CaptureImage works without crashing, however, it has the disadvantage that it copies whatever is in the background at the corners of a window. This can interfere with the screenshot comparisons in the automated GUI tests I am developing. (Hidden windows are not a problem, as the screenshots are always of the window in the foreground.)

I will continue to experiment with this problem.