PRB: J/Direct Call to IMM32.ImmSetOpenStatus Fails on Windows 2000

SYMPTOMS

On Windows 2000 with Japanese support enabled, a J/Direct call to the IMM32.ImmSetOpenStatus function always fails, returning false in a Java applet. For example, the following sample code always returns false:
int hImc = IMM32.ImmGetContext(0);boolean b = IMM32.ImmSetOpenStatus(hImc, true);

CAUSE

This problem occurs because the call to the ImmSetOpenStatus function is made from an invalid input context thread. The input context thread should be a browser-created thread; however, in this example, java.lang.Thread calls ImmSetOpenStatus of IMM32.

RESOLUTION

To ensure that the correct input context thread is used (namely, to get onto the correct thread to own the window), follow these steps:

  1. Call the SetWindowLong function with the GWL_WNDPROC index as follows to create a subclass of the window that specifies the associated window procedure:
    int root = com.ms.wfc.util.Root.alloc(new HookProc());com.ms.win32.User32.SetWindowLong(hWnd, com.ms.win32.wing.GWL_WNDPROC, DllLib.addrOf(root));
  2. Create the HookProc window procedure class so that it extends the com.ms.dll.Callback class, and make sure to use the CallWindowProc function to call the previously registered window procedure for any messages that HookProc does not process as follows:
    class HookProc extends Callback {...public int callback(int hwnd, int msg, int wparam, int lparam) {         ...         ...int hImc = IMM32.ImmGetContext(hwnd);boolean b = IMM32.ImmSetOpenStatus(hImc, true);...         ...return 0;}         ...}

REFERENCES

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:
Propiedades

Id. de artículo: 301358 - Última revisión: 14 feb. 2017 - Revisión: 1

Comentarios