Hi!
I have written an image processing application with the GUI part written in Java and the number crunching part is written in C and is called via JNI.
My problem is that it takes 20 - 30 seconds for the application to process an image, and during this time the application disappears from the Task Switcher (the Alt-Tab thingy) and it is not possible to move the application's window to the front (this is my main concern). It is still possible to bring the application to front via the task bar.
Some more info:
- The application isn't stuck or anything, I can see that it updates a progress bar as expected.
- When the calculation is done, the application will show up the Task Switcher and can become the top window again. If I start a new calculation the application will disappear from the Task Switcher again.
- The JNI call is made on a separate thread (from EDT), I have tried both the main thread and a created thread.
- The EDT is not blocked. I have added printfs in WindowListener's and WindowFocusListener's methods and if the window lose focus the appropriate methods are called.
- On Mac OS X the application works without problem.
- This is on Java 1.6 on Windows 2003 Server.
- First I thought that it was openMP that was doing something nasty with the threads, but turning it off didn't make any difference.
- The JNI lib is compiled with MinGW 4.5.
It seems to me that Windows expects that an application answer/send some requests or else it will be thrown out of the Task Switcher. But I don't even know enough about Windows programming to even be able to google for an answer. Can someone give me some pointers?