2107.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 22 行

HTML
22
字号
<html>
  <head>
    <title>Re: 拆出中文字的字码</title>
  </head>
  <BODY BACKGROUND="" BGCOLOR="white" TEXT="black" LINK="red" VLINK="#808080" ALINK="">
    <center>
      <h1>Re: 拆出中文字的字码</h1>
    </center>

<HR><p>
Posted by <a href="mailto:cww5@mail.ncku.edu.tw">cww</a> on February 26, 1998 at 00:18:28:<p>
In Reply to: <a href="2099.html"><b>拆出中文字的字码</b></a> posted by 阿晴 on February 25, 1998 at 06:09:34:<p>
我试过这类的function,可以把某个中文字拆出它的字根,若为注音,可<br>以拆出其拼音及破音字的拼法,如: "的" 大易输入可传回"竹日马点"<br>注音可传回 "ㄉ ㄜ˙"  "ㄉㄧ ˊ"  "ㄉㄧ ˋ”,不过却没有找到<br>直接Mapping到英文的作法(如:注音"的" --> dk7 ),不过最少可以建表<br>去Mapping<p>Private Sub Command1_Click()<br>Dim hkb As Long<br>hkb = GetKeyboardLayout(0)<br>Text2.Text = ImeQueryComp(hkb, Text1.Text, 1)<br>End Sub<p>'hKB :keyboard handle, cChinaWord:中文字, nth :第n个拆字法(字根组合),由1起算<br>Public Function ImeQueryComp(ByVal hkb As Long, ByVal bChinaWord As String, Optional nth As Variant) As String<br>Dim iMaxkey  As Long, dwGCL As Long<br>Dim tCandidate As CANDIDATELIST<br>Dim iStart As Long, i As Long, j As Long, icount As Integer<br>Dim dwBuff() As Byte<br>Dim result() As Byte<p>If IsMissing(nth) Then<br>   nth = 1<br>End If<p>ImeQueryComp = ""<br>iMaxkey = ImmEscape(hkb, 0, IME_ESC_MAX_KEY, vbNullString)<p>If iMaxkey  0 Then<br>    If nth > icount Then    '没有nth个的candidate<br>        Exit Function<br>    End If<br>    iStart = dwBuff(24 + (nth - 1) * 4)<br>    j = 0<br>    ReDim result(iMaxkey * 2)<br>    For i = iStart To iStart + iMaxkey * 2<br>        result(j) = dwBuff(i)<br>        j = j + 1<br>    Next i<br>    ImeQueryComp = StrConv(result, vbUnicode)<br> End If<br>End Function<br>
<br>
<p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 2107-->
</ul><!--end: 2107-->
<br><HR><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?