JNI modal call disables taskbar icon

In a Java application (JRE 1.5.0_12) on Windows XP, I call my own method:

public native int attachImage( ... );

      

... which is in Visual C ++ 6.0.dll. It displays the mod app window. The problem is that the taskbar icon does not respond to mouseclicks while this window has focus. This is a problem because when this window is displayed, users often switch to another application to select an attached image and then want to restore that application.

+1


source to share


2 answers


Which GUI package are you using?

You should be able to implement this without resorting to JNI calls.

For example, in SWT, you can open the modal application wrapper like this:



Shell shell = new Shell(display,SWT.APPLICATION_MODAL);

      

For swing it would be:

dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);

      

+1


source


Is your attachImage method wrong to set parent window to java application window? Getting the hwnd for this can be tricky (GetForegroundWindow / etc?), But might it be necessary?



Also, why should part of the image be JNI? what can help us find a solution that avoids the JNI part altogether?

0


source







All Articles