IME管理基本函数

Windows9x系统提供的ime管理函数  
   
    上一章,我们介绍了ime文件中必须设计的函数,这些函数要靠我们自己来设计。要完成这些函数的设计,需用到windows系统提供的管理函数(Input    
  Method   Manager,简称IMM)。  
   
          IMM函数可以被IME函数使用,也可用于应用软件直接管理IME。  
   
          相关术语:  
   
                  (1)input   method   context    
  简称IMC--输入法相关部分,在这里解释为:相关连的应用程序(进程)  
   
                  (2)component   of   the   input   context        
  简称IMCC--IMC的部件,是INPUTCONTEXT   结构的成员。  
   
  一、IME中使用的IMM函数清单  
   
  ImmGetCompositionWindow                      //取编码窗口信息
      
  ImmSetCompositionWindow                     //设置编码窗口信息  
   
  ImmGetCandidateWindow                     //取选择窗口信息  
   
  ImmSetCandidateWindow                   //设置选择窗口信息  
   
  ImmGetCompositionString                   //取编码窗口的某一信息  
   
  ImmSetCompositionString                   //设置编码窗口的某一信息  
   
  ImmGetCompositionFont                     //取编码字体  
   
  ImmSetCompositionFont                       //设置编码字体  
   
  ImmGetNumCandidateList                      //取选择区中编码数  
   
  ImmGetCandidateList                        //取选择区中编码  
   
  ImmGetGuideLine  
   
  ImmGetConversionStatus                //取当前输入法的状态(ACSII,SHAPE,FULL等)  
   
  ImmGetConversionList                         //重新获得选择区转换表  
   
  ImmGetOpenStatus                              //取输入法打开属性 
 
  ImmSetConversionStatus                       //设置输入法状态  
   
  ImmSetOpenStatus                            //设置输入法打开状态  
   
  ImmNotifyIME                                 //通报IME,输入法状态被改变  
   
  ImmGenerateMessage                          //将我们的汉字串法发送到与当前输入法相关联的应用软件中  
                   
  ImmRequestMessage                             //向应用程序发送WM_IME_REQUEST  
   
  ImmLockIMC                              //获取当前IMC的INPUTCONTEXT结构信息,增加IMC计数器  
                   
  ImmUnlockIMC                                 //释放IMC计数器  
                   
  ImmGetIMCLockCount                           //取计数器值  
                   
  ImmCreateIMCC                                //创建INPUTCONTEXT结构的一个成员  
                   
  ImmDestroyIMCC                     //删除IMC成员缓冲区  
                   
  ImmLockIMCC                             //取IMCC缓冲地址,同时使IMCC的计数器值增加  
                 
  ImmUnlockIMCC                             //递减IMCC计数器  
                   
  ImmReSizeIMCC                            //重新设置IMC的成员的缓冲区大小  
                 
  ImmGetIMCCSize                               //取IMC成员的缓冲区大小  
                         
  ImmGetIMCCLockCount                 //返回IMC计数器值  
                         
  ImmGetHotKey                               //取输入法状态键,该函数供控制面板使用  
   
  ImmSetHotKey                             //设置输入法的热键  
                         
  ImmCreateSoftKeyboard                      //产生一个软键盘  
                         
  ImmDestroySoftKeyboard                       //销毁软键盘  
                         
  ImmShowSoftKeyboard               //显示或隐藏软键盘  


二、IMM函数使用格式说明  
   
  1、BOOL   WINAPI   ImmGenerateMessage(                          
  //将我们的汉字串法发送到与当前输入法相关联的应用软件中  
                  HIMC   hIMC                                                                                                          
  //与当前输入法相关联的应用软件的句柄,  
   
  //该结构的hMsgBuf项即为汉字串消息  
                  )  
   
            成功为TRUE,否则为FALSE  
   
  2、LRESULT   WINAPI     ImmRequestMessage(             //向应用程序发送WM_IME_REQUEST  
   
                                                                                                                                                             
        //只是用于w98及w2000  
                          HIMC   hIMC,                                                                                                    
  //与当前输入法相关联的应用软件的句柄  
                          WPARAM   wParam,                                                                                
  //与WM_IME_REQUEST相关的wP  
                          LPARAM   lParam                                                                                      
  //与WM_IME_REQUEST相关的LP  
   
                                                                                                                                                             
      //=IMR_COMPOSITIONWINOW  
   
                                                                                                                                                             
        //=IMR_CANDIDATEWINDOW  
   
                                                                                                                                                             
        //=IMR_COMPOSITIONFONT  
   
                                                                                                                                                             
          //=IMR_RECONVERTSTRING  
   
                                                                                                                                                             
          //=IMR_CONFIRMRECONVERTSTRING  
   
                                                                                                                                                             
          //=IMR_QUERYCHARPOSITION  
   
                                                                                                                                                             
          //=IMR_DOCUMENTFEED  
   
   
                  )  
   
  3、LPINPUTCONTEXT     WINAPI   ImmLockIMC(            
  //获取当前IMC的INPUTCONTEXT结构信息,增加IMC   计数器  
                          HIMC   hIMC                                                                                                        
  //当前应用程序句柄  
                          )  
   
                  成功返回INPUTCONTEXT   结构指针,否则为NULL  
   
  4、BOOL   WINAPI   ImmUnlockIMC(         //释放IMC计数器  
                          HIMC   hIMC                                                                     //当前应用程序句柄  
                          )  
   
                    返回:如果IMC计数器被减少到0了,返回FALSE,否则为TRUE.  
   
        注意:ImmLockIMC与ImmUnlockIMC必须成对出现,必须是相同的HIMC  
   
  5、HIMCC   WINAPI   ImmGetIMCLockCount(                 //取计数器值  
                          HIMC   hIMC                                                                                                    
  //当前应用程序句柄  
                  )  
   
                如果成功返回HIMC的计数器值,否则为NULL.  
   
  6、HIMCC   WINAPI   ImmCreateIMCC(                             //创建INPUTCONTEXT结构的一个成员  
                          DWORD   dwSize                                                                              
  //成员的缓冲区长度  
                  )  
   
        如果成功返回IMC的成员句柄,否则为NULL  
   
  7、HIMCC   WINAPI   ImmDestroyIMCC(                       //删除IMC成员缓冲区  
                          HIMCC   hIMCC                                                                                
  //被删除的IMC的成员  
                  )  
   
  如果成功返回NULL,否则等于该HIMCC.  
   
  8、LPVOID   WINAPI     ImmLockIMCC(              
  //取IMCC缓冲地址,同时使IMCC的计数器值增加  
                          HIMCC   hIMCC                                                                   //IMC成员句柄  
                  )  
   
  If   the   function   is   successful,   the   return   value   is   the   pointer   for   the   IMC    
  component.   Otherwise,   the   return   value   is   NULL.  
   
  9、BOOL   WINAPI   ImmUnlockIMCC(             //递减IMCC计数器  
                          HIMCC   hIMCC                                                                 //IMC成员句柄  
                  )  
   
              如果IMCC的计数器值为零,则返回   FALSE,否则为TRUE.  
   
  10、HIMCC   WINAPI   ImmReSizeIMCC(   //重新设置IMC的成员的缓冲区大小  
                          HIMCC   hIMCC,                                                                       //IMC的成员句柄  
                          DWORD   dwSize                                                                   //新缓冲区大小  
                  )  
   
                  如果成功,返回新的HIMCC,否则为   NULL.  
   
  11、DWORD   WINAPI   ImmGetIMCCSize(               //取IMC成员的缓冲区大小  
                                  HIMCC   hIMCC                                                                            
  //IMC成员句柄  
                          )  
   
                        返回IMC成员的缓冲区大小  
   
  12、DWORD   WINAPI   ImmGetIMCCLockCount(       //返回IMC计数器值  
                                  HIMCC   hIMCC                                                                                        
  //IMC成员的句柄  
                          )  
   
                  成功返回该IMCC的计数器值,否则为0  
   
  13、BOOL   WINAPI   ImmGetHotKey(                        
  //取输入法状态键,该函数供控制面板使用  
                                  DWORD   dwHotKeyID,  
                                  LPUINT   lpuModifiers,  
                                  LPUINT   lpuVKey,  
                                  LPHKL   lphKL  
                          )  
   
  14、BOOL   WINAPI   ImmSetHotKey(         //设置输入法的热键  
                                  DWORD   dwHotKeyID,  
                                  UINT   uModifiers,  
                                  UINT   uVKey,  
                                  hKL   hKL  
                          )  
   
  15、HWND   WINAPI   ImmCreateSoftKeyboard(                       //产生一个软键盘  
                                  UINT   uType,                                                                                                      
          //软件盘上的键码含义的定义方式  
   
                                                                                                                                                             
      //=SOFTKEYBOARD_TYPE_T1  
   
                                                                                                                                                             
  //=SOFTKEYBOARD_TYPE_C1  
                                  UINT   hOwner,                                                                                                    
  //该输入法的UI窗口  
                                  int   x,                                                                                                                
                  //定位坐标  
                                  int   y                                                                                                                  
                //定位坐标  
                          )  
   
          成功返回软键盘的窗口句柄  
   
  16、BOOL   WINAPI   ImmDestroySoftKeyboard(             //销毁软键盘  
                                  HWND   hSoftKbdWnd                                                                          
  //软年盘窗口句柄  
                          )  
   
              成功为TRUE,法哦则为FALSE.  
   
  17、BOOL   WINAPI     ImmShowSoftKeyboard(             //显示或隐藏软键盘  
                                  HWND   hSoftKbdWnd,                                                                        
  //软年盘窗口句柄  
                                  int   nCmdShow                                                                                          
  //窗口状态=SW_HIDE   表示隐藏,=SW_SHOWNOACTIVATE表示显示  
                                )  
   
  如构成功返回   TRUE.   否则为   FALSE.  
   
  Top

在HKEY_USERS:".DEFAULT/keyboardlayout/preload"放的是已安装的输入法,下有几个以数字为名的子键,内容是输入法代号(keyboard   layout),
如"e0040804",其中左4位是设备代码(device   identifier),右4位是语言代码(language   identifier)。简体输入法的序号为E02x0804(x为’0’-‘9’的数字)  
  在HKEY_LOCAL_MACHINE:"System/CurrentControlSet/Control/KeyboardLayouts/"放的是已注册的输入法。
他的子键名为输入法代号(keyboard   layout),内容为该输入法的ime文件,名称等信息。  
   
再往下LoadKeyboardLayout   装入输入法的键盘布局    
   

 

使用MFC编写的基于WINCE, WM6.x操作系统的 关于输入法控制函数的示例代码。 10/29/2008 The following table shows Input Method Manager (IMM) functions with a description of the purpose of each. In This Section EnumRegisterWordProc This function is an application-defined callback function used with the ImmEnumRegisterWord function. It is used to process data of register strings. ImmAssociateContext This function associates the specified input context with the specified window. ImmAssociateContextEx This function changes the association between the input method context and the specified window or its children. ImmConfigureIME This function displays the configuration dialog box for the IME. ImmCreateContext This function creates a new input context, allocating memory for the context and initializing it. ImmCreateIMCC This function enables an IME to create a new input method context (IMC) component that is a member of an IMC. ImmDestroyContext This function releases the input context and frees any memory associated with it. ImmDestroyIMCC This function enables an IME to destroy an input method context (IMC) component that is a member of an IMC. ImmDisableIME This function disables the IME for the current thread. ImmEnumRegisterWord This function enumerates the register strings having the specified reading string, style, and register string. ImmEscape This function carries out IME–specific subfunctions and is used mainly for locale-specific functions. ImmGenerateMessage This function enables an IME to generate messages that are sent to the window associated with the input method context (IMC). ImmGetCandidateList This function retrieves a specified candidate list, copying the list to the specified buffer. ImmGetCandidateListCount This function retrieves the size, in bytes, of the candidate lists. ImmGetCandidateWindow This function gets information about the candidate list window. ImmGetCompositionFont This function retrieves information about the logical font currently used to display characters in the composition window. ImmGetCompositionString This function retrieves information about the composition string. ImmGetCompositionWindow This function gets information about the composition window. ImmGetContext This function retrieves the input context associated with the specified window. ImmGetConversionList This function retrieves the list of characters or words from one character or word. ImmGetConversionStatus This function gets the current conversion status. ImmGetConversionStatusForeground This function retrieves the current IME conversion and sentences modes for the foreground thread. ImmGetDefaultIMEWnd This function gets the default window handle to the IME class. ImmGetDescription This function copies the description of the IME to the specified buffer. ImmGetGuideLine This function gets information about errors. Applications use the information to notify users. ImmGetHotKey This function retrieves the value of the IME hot key. ImmGetIMCCLockCount This function enables an IME to get the lock count of the input method context (IMC) component. ImmGetIMCCSize This function enables an IME to get the size of the input method context (IMC) component. ImmGetIMEFileName This function gets the file name of the IME associated with the specified keyboard layout. ImmGetImeMenuItems This function retrieves the menu items that are registered in the IME menu. ImmGetOpenStatus
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值