反查漢字拼音

I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
var
iHandleCount: integer;
pList: array[1..nHKL_LIST] of HKL;
szImeName: array[0..254] of char;
i: integer;
sFound: string;
begin
lstComposition.Items.Clear;
iHandleCount := GetKeyboardLayoutList(nHKL_LIST, pList);
for i := 1 to iHandleCount do
begin
if ImmEscape(pList, 0, IME_ESC_IME_NAME, @szImeName) > 0 then
begin
sFound := QueryCompStr(pList, edtExam.Text);
if sFound <> '' then
lstComposition.Items.Add(StrPas(szImeName) + ': ' + sFound);
end;
end;
**************
金山词霸(2.0-2000版本)内有gb2py.idx和gbk2py.idx,内有国标
GB、GBK的每个汉字的拼音和声调。可用拿来一用。
下面上Delphi写的gb2py函数。
function gb2py(hanzi:pchar):pchar;
var
Sfile:Tmemorystream;
pos,temp,ipos,len:integer;
py:array[0..20] of char;
begin
pos:=($fe-$a1)*(ord(hanzi[0])-$b0)+ord(hanzi[1])-$a1;
sfile:=Tmemorystream.create;
sfile.loadfromfile('C:Filespy.idx');
//data:=sfile.memory;
sfile.Seek($1608+pos*4,soFromBeginning);
sfile.Read(ipos,4);
sfile.Read(temp,4);
len:=temp-ipos;
sfile.Seek(ipos+1,soFromBeginning);
sfile.Read(py,len);
py[len-1]:=#0;
sfile.Free;
result:=py;
end;
 

Similar threads

I
回复
0
查看
594
import
I
I
回复
0
查看
776
import
I
I
回复
0
查看
657
import
I
顶部