zoukankan      html  css  js  c++  java
  • VS2005IDE中输入法全角[控制输入问题]

     1using   System;   
     2  using   System.Collections.Generic;   
     3  using   System.ComponentModel;   
     4  using   System.Data;   
     5  using   System.Drawing;   
     6  using   System.Text;   
     7  using   System.Windows.Forms;   
     8  using   System.Runtime.InteropServices;   
     9    
    10  namespace   Lqjt   
    11  {   
    12          public   partial   class   ImeForm   :   Form   
    13          {   
    14                  public   ImeForm()   
    15                  {   
    16                          InitializeComponent();   
    17                  }
       
    18                  //声明一些API函数   
    19                  [DllImport("imm32.dll")]   
    20                  public   static   extern   IntPtr   ImmGetContext(IntPtr   hwnd);   
    21                  [DllImport("imm32.dll")]   
    22                  public   static   extern   bool   ImmGetOpenStatus(IntPtr   himc);   
    23                  [DllImport("imm32.dll")]   
    24                  public   static   extern   bool   ImmSetOpenStatus(IntPtr   himc,   bool   b);   
    25                  [DllImport("imm32.dll")]   
    26                  public   static   extern   bool   ImmGetConversionStatus(IntPtr   himc,   ref   int   lpdw,   ref   int   lpdw2);   
    27                  [DllImport("imm32.dll")]   
    28                  public   static   extern   int   ImmSimulateHotKey(IntPtr   hwnd,   int   lngHotkey);   
    29                  private   const   int   IME_CMODE_FULLSHAPE   =   0x8;   
    30                  private   const   int   IME_CHOTKEY_SHAPE_TOGGLE   =   0x11;   
    31                  protected   override   void   OnActivated(EventArgs   e)   
    32                  {   
    33                          base.OnActivated(e);   
    34                          IntPtr   HIme   =   ImmGetContext(this.Handle);   
    35                          if   (ImmGetOpenStatus(HIme))     //如果输入法处于打开状态   
    36                          {   
    37                                  int   iMode   =   0;   
    38                                  int   iSentence   =   0;   
    39                                  bool   bSuccess   =   ImmGetConversionStatus(HIme,   ref   iMode,   ref   iSentence);     //检索输入法信息   
    40                                  if   (bSuccess)   
    41                                  {   
    42                                          if   ((iMode   &   IME_CMODE_FULLSHAPE)   >   0)       //如果是全角   
    43                                                  ImmSimulateHotKey(this.Handle,   IME_CHOTKEY_SHAPE_TOGGLE);     //转换成半角   
    44                                  }
       
    45    
    46                          }
       
    47                  }
       
    48          }
    //form   
    49  }
  • 相关阅读:
    游戏热更思路
    Shader实现新手指引挖空圆形和矩形
    C#利用栈实现字符串运算解析
    Unity UGUI和特效(含粒子系统和3D Object)之间层级问题
    Unity中的值传递与引用传递
    Unity3D中的线程与协程
    进程、线程、协程、CPU
    Photon Server与Unity3D客户端的交互
    Photon Server的Unity3D客户端配置
    Photon Server的服务器端配置
  • 原文地址:https://www.cnblogs.com/winnxm/p/989506.html
Copyright © 2011-2022 走看看