如何取得每个汉字的五笔打法的第一个字母和拼音的第一个字母? 如何取得每个汉字的五笔打法的第一个字母和拼音的第一个字母?谢谢!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 从汉字来得到首字母的方法,你再扩展一下应就可以满足你的需求了.unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } function getpy(hzchar:string):char; end;var Form1: TForm1;implementation{$R *.dfm}{ TForm1 }function TForm1.getpy(hzchar: string): char;begin case WORD(hzchar[1])shl(8)+WORD(hzchar[2]) of $B0A1..$B0C4 : result:='A'; $B0C5..$B2C0 : result:='B'; $B2C1..$B4ED : result:='C'; $B4EE..$B6E9 : result:='D'; $B6EA..$B7A1 : result:='E'; $B7A2..$B8C0 : result:='F'; $B9C1..$B9FD : result:='G'; $B9FE..$BBF6 : result:='H'; $BBF7..$BFA5 : result:='J'; $BFA6..$C0AB : result:='K'; $C0AC..$C2E7 : result:='L'; $C2E8..$C4C2 : result:='M'; $C4C3..$C5B5 : result:='N'; $C5B6..$C5BD : result:='O'; $C5BE..$C6D9 : result:='P'; $C6DA..$C8BA : result:='Q'; $C8BB..$C8F5 : result:='R'; $C8F6..$CBF9 : result:='S'; $CBFA..$CDD9 : result:='T'; $CDDA..$CEF3 : result:='W'; $CEF4..$D188 : result:='X'; $D189..$D4D0 : result:='Y'; $D4D1..$D7F9 : result:='Z'; else result:=char(0); end;end;procedure TForm1.Button1Click(Sender: TObject);var s:string;begin s:=getpy('新')+getpy('闻')+getpy('频')+getpy('道'); showmessage(s);end;end. 五笔的.根据汉字查输入法的编码 function QueryCompStr(hKB: HKL; const sChinese: AnsiString): string; vardwGCL: DWORD;szBuffer: array[0..254] of char;iMaxKey, iStart, i: integer;beginResult := '';iMaxKey := ImmEscape(hKB, 0, IME_ESC_MAX_KEY, nil);if iMaxKey <= 0 then exit;dwGCL := ImmGetConversionList(hKB,0,pchar(sChinese),nil,0,GCL_REVERSECONVERSION);if dwGCL <= 0 then Exit;dwGCL := ImmGetConversionList(hKB,0,pchar(sChinese),@szBuffer,dwGCL,GCL_REVERSECONVERSION);if dwGCL > 0 thenbeginiStart := byte(szBuffer[24]);for i := iStart to iStart + iMaxKey * 2 doAppendStr(Result, szBuffer[i]);end;end;但是上面的程序有问题,解决如下:------------------------------------------------------------在QueryCompStr中做如下修改就好(test in:win98 se+delphi5)dwGCL := dwGCL+sizeof(TCandidateList); //add this line then ok,编码查询功能只支持单字,不支持词组。dwGCL := ImmGetConversionList(hKB,0,pchar(sChinese),@szBuffer,dwGCL,GCL_REVERSECONVERSION);----------------------------------------------------------------按照pqx给我的答案,问题已解决部分,但用这种方法并不是所有的输入法都能查出,而用Windows自已的编码查询功能(右击输入法提示条,设置->编码查询,选择相应的输入法)则都能查出来,这是为什么呢?(如“王码五笔4.0”就查不出,而微软的“王码五笔86版”、“王码五笔98版”则都能查到。)反查编码的的例子可以到 http://www.mildragon.com 的“学习园地”下载。本例是改自台湾钱达智先生的一个例子QRYCOMP(可以在Delphi深度历险中下载)。*********variHandleCount: integer;pList: array[1..nHKL_LIST] of HKL;szImeName: array[0..254] of char;i: integer;sFound: string;beginlstComposition.Items.Clear;iHandleCount := GetKeyboardLayoutList(nHKL_LIST, pList);for i := 1 to iHandleCount dobeginif ImmEscape(pList[i], 0, IME_ESC_IME_NAME, @szImeName) > 0 thenbeginsFound := QueryCompStr(pList[i], edtExam.Text);if sFound <> '' thenlstComposition.Items.Add(StrPas(szImeName) + ': ' + sFound);end;end; KeyPress事件中怎样写按CTRL+C键的代码 求一个sql语句!!!在线等,,,急需!! 天下之大,无奇不有!有答就有分 Fastreport打印套表问题!! (弱问)高手来帮我看看这段程序有什么问题? 出現錯誤'逾時超時' 查车牌的SQL语句 在Delphi中有没有替换函数??? 我想学DELPHI,请各位给点建议。来者有分 在delphi5.0中,怎样把记录类型的数据保存到一个文件中,然后又从文件里读到记录中。 谁知道那里可以下载 整理DELPHI7源代码的工具?送30分 字符串中想递换某一指定的子字符串是用什么函数?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function getpy(hzchar:string):char;
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }function TForm1.getpy(hzchar: string): char;
begin
case WORD(hzchar[1])shl(8)+WORD(hzchar[2]) of
$B0A1..$B0C4 : result:='A';
$B0C5..$B2C0 : result:='B';
$B2C1..$B4ED : result:='C';
$B4EE..$B6E9 : result:='D';
$B6EA..$B7A1 : result:='E';
$B7A2..$B8C0 : result:='F';
$B9C1..$B9FD : result:='G';
$B9FE..$BBF6 : result:='H';
$BBF7..$BFA5 : result:='J';
$BFA6..$C0AB : result:='K';
$C0AC..$C2E7 : result:='L';
$C2E8..$C4C2 : result:='M';
$C4C3..$C5B5 : result:='N';
$C5B6..$C5BD : result:='O';
$C5BE..$C6D9 : result:='P';
$C6DA..$C8BA : result:='Q';
$C8BB..$C8F5 : result:='R';
$C8F6..$CBF9 : result:='S';
$CBFA..$CDD9 : result:='T';
$CDDA..$CEF3 : result:='W';
$CEF4..$D188 : result:='X';
$D189..$D4D0 : result:='Y';
$D4D1..$D7F9 : result:='Z';
else
result:=char(0);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
s:=getpy('新')+getpy('闻')+getpy('频')+getpy('道');
showmessage(s);
end;end.
function QueryCompStr(hKB: HKL; const sChinese: AnsiString): string;
vardwGCL: DWORD;szBuffer: array[0..254] of char;iMaxKey, iStart, i: integer;beginResult := '';iMaxKey := ImmEscape(hKB, 0, IME_ESC_MAX_KEY, nil);if iMaxKey <= 0 then exit;dwGCL := ImmGetConversionList(hKB,0,pchar(sChinese),nil,0,GCL_REVERSECONVERSION);if dwGCL <= 0 then Exit;dwGCL := ImmGetConversionList(hKB,0,pchar(sChinese),@szBuffer,dwGCL,GCL_REVERSECONVERSION);if dwGCL > 0 thenbeginiStart := byte(szBuffer[24]);for i := iStart to iStart + iMaxKey * 2 doAppendStr(Result, szBuffer[i]);end;end;但是上面的程序有问题,解决如下:------------------------------------------------------------在QueryCompStr中做如下修改就好(test in:win98 se+delphi5)dwGCL := dwGCL+sizeof(TCandidateList); //add this line then ok,编码查询功能只支持单字,不支持词组。dwGCL := ImmGetConversionList(hKB,0,pchar(sChinese),@szBuffer,dwGCL,GCL_REVERSECONVERSION);----------------------------------------------------------------按照pqx给我的答案,问题已解决部分,但用这种方法并不是所有的输入法都能查出,而用Windows自已的编码查询功能(右击输入法提示条,设置->编码查询,选择相应的输入法)则都能查出来,这是为什么呢?(如“王码五笔4.0”就查不出,而微软的“王码五笔86版”、“王码五笔98版”则都能查到。)反查编码的的例子可以到 http://www.mildragon.com 的“学习园地”下载。本例是改自台湾钱达智先生的一个例子QRYCOMP(可以在Delphi深度历险中下载)。*********variHandleCount: integer;pList: array[1..nHKL_LIST] of HKL;szImeName: array[0..254] of char;i: integer;sFound: string;beginlstComposition.Items.Clear;iHandleCount := GetKeyboardLayoutList(nHKL_LIST, pList);for i := 1 to iHandleCount dobeginif ImmEscape(pList[i], 0, IME_ESC_IME_NAME, @szImeName) > 0 thenbeginsFound := QueryCompStr(pList[i], edtExam.Text);if sFound <> '' thenlstComposition.Items.Add(StrPas(szImeName) + ': ' + sFound);end;end;