IME Window

IME Window

IME Window is an object window to receive any of the IME user interface related message in PM environment. Its main purpose is to receive display request event messages from Application, System or IME itself. If IME Window receives those request, IME Window communicates with the appropriate part windows(described below) to show the part contents. IME Window class is provided by IME and it is registered by the system at ImeInitialize timing. When an IMInstance is created, IME Window is automatically created by the system and it has following window words:

IME Window is able to retrieve the IMInstance handle to access the IMInstance data, by calling WinQueryWindowULong with QWL_IMEW_HIMI, except that

QWL_HIMI field does not contain IMInstance handle at WM_CREATE message.

IME Window also have 4 byte area to hold instance specific data. It is accessible through QWL_IMEW_PRIVATE.

Other window words represents the window handle of each default part class which is supplied by the system. These areas are filled when the system needs to pass the WM_IMEREQUEST message to each part class. (Usually, it is IMR_INSTANCEACTIVATE event)

There is an option not to provide IME Window class if IME does not want to display any unique user interface. In that case the system creates the default IME Window and its Part Windows, i.e., default user interface is used.

System provides WinDefImeWndProc (See below) for the default window procedure for IME Window class. Typical IME Window procedure looks like follows:

MRESULT APIENTRY MyImeWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ){
    switch ( msg )
    {
        case WM_CREATE:
            // allocate private memory for this IMInstance.
            pPrivate = alloc();
            WinSetWindowULong(hwnd, QWL_IMEW_PRIVATE, pPrivate);
            break;

        case WM_DESTROY:
            // free private memory
            pPrivate = WinQueryWindowULong(hwnd, QWL_IMEW_PRIVATE);
            free( pPrivate );
            break;

        case WM_QUERYIMEWINDOWCAPS:
            switch ( (ULONG)mp1 )
            {
                case IWC_CONVERSIONANGLE:
                    *((PULONG)mp2) = UIC_ANGLEANY;
                    return (MRESULT)TRUE;

                case IWC_CONVERSIONMARGIN:
                    *((PULONG)mp2) = MARGIN;
                    return (MRESULT)TRUE;

                case IWC_FORCEPOSITION:
                    *((PULONG)mp2) = TRUE;
                    return (MRESULT)TRUE;
            }
            break;
        case WM_IMEREQUEST:
            pPrivate = WinQueryWindowULong(hwnd, QWL_IMEW_PRIVATE);
            // IME specific processing.
            // WinDefImeWindowProc can be callable if IME needs the
            // default processing.
                        :
                break;

        case WM_IMECONTROL:
        case WM_IMENOTIFY:
            // IME Window does not expect to see these messages.
            break;

        default:
            return WinDefImeWindowProc( hwnd, msg, mp1, mp2 );
    }

    return (MRESULT)FALSE;
}


[Back: Part]
[Next: WinDefImeWindowProc]