I wrote an image processing application with a part of the GUI written in Java, and the part of the crunching number is written in C and called through JNI.
My problem is that it takes 20-30 seconds to process the image, and during this time the application disappears from the Task Switcher (Alt-Tab thingy element), and it is impossible to move the application window to the front (this is my main concern). You can still bring the application to the forefront through the taskbar.
Additional Information:
- The application is not stuck or something else, I see that it is updating the progress bar as expected.
- When the calculation is completed, the application displays Task Switcher and can again become the top window. If I start a new calculation, the application will disappear from the task manager again.
- The JNI call is made in a separate thread (from the EDT), I tried both the main thread and the created thread.
- EDT is not blocked. I added printfs to the WindowListener and WindowFocusListener methods, and if the window loses focus, the corresponding methods are called.
- On Mac OS X, the application works without problems.
- This is on Java 1.6 on Windows 2003 Server.
- At first I thought it was openMP, which was doing something unpleasant with streams, but disabling it did not make any difference.
- JNI lib compiled with MinGW 4.5.
It seems to me that Windows expects the application to answer / send some requests, otherwise it will be thrown out of the Task Switcher. But I donβt even know enough about Windows programming to even be able to respond to Google requests. Can someone give me some pointers?