假设有
S ='一';
如何得到S的拼音?
谁有思路?难不成要列举所有的拼音?
S ='一';
如何得到S的拼音?
谁有思路?难不成要列举所有的拼音?
解决方案 »
- 关于Delhi中dbgrideh保存数据的问题
- 谁能发个delphi7的dent.slip给我,谢了。[email protected]
- spcomm中如何发送接受double的数据?
- 怎样获得鼠标当前位置?想在OnClick事件中得到鼠标的位置。
- 高分求DELPHI中文帮助,请大家帮助一下菜鸟
- 高手们救命呀!!TRichEdit每添加一行(lines.add()),怎样显示最后一行,即会自动滚动,前提是不用鼠标点击。此问题搞得我头晕都没办法。
- 这样漂亮的界面如何实现?
- 用哪个函数可以实现替换某字符串中某几个字符的功能?位置不确定。
- Delphi调用Excel的高手请入:Server征解
- 有没有人用过Debug View?
- 如何判断Edit1.Text是不是数字?最好有代码。
- 大家一起来讨论Win98系统的问题!
出处:电脑爱好者
责任编辑:zwg
[02-3-25 16:42] 作者:Daffodil
程序代码如下:
unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Buttons, IMM; type TForm1 = class(TForm) OpenDialog1: TOpenDialog; BitBtn2: TBitBtn; BitBtn3: TBitBtn; Edit2: TEdit; Edit1: TEdit; Label5: TLabel; Label1: TLabel; BitBtn1: TBitBtn; procedure BitBtn1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure BitBtn3Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); public iHandleCount: integer; pList : array[1..20] of HKL; szImeName : array[0..254] of char; II : integer; end;
const pych: array[1..6,1..5] of string[2]= (('ā', 'á','ǎ','à','a'),('ō', 'ó','ǒ','ò','o'), ('ē', 'é','ě','è','e'),('ī', 'í','ǐ','ì','i'), ('ū', 'ú','ǔ','ù','u'),('ǖ', 'ǘ','ǚ','ǜ','ü'));
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject); var i: integer; begin II := 0; //retrieves the keyboard layout handles corresponding to the current set of input locales in the system. iHandleCount := GetKeyboardLayoutList(20, pList); for i := 1 to iHandleCount do begin if ImmEscape(pList[i], 0, IME_ESC_IME_NAME, @szImeName) > 0 then if szImeName='微软拼音输入法' then begin
StdCtrls, ExtCtrls, Buttons, IMM; type TForm1 = class(TForm) OpenDialog1: TOpenDialog; BitBtn2: TBitBtn; BitBtn3: TBitBtn; Edit2: TEdit; Edit1: TEdit; Label5: TLabel; Label1: TLabel; BitBtn1: TBitBtn; procedure BitBtn1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure BitBtn3Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); public iHandleCount: integer; pList : array[1..20] of HKL; szImeName : array[0..254] of char; II : integer; end;
const pych: array[1..6,1..5] of string[2]= (('ā', 'á','ǎ','à','a'),('ō', 'ó','ǒ','ò','o'), ('ē', 'é','ě','è','e'),('ī', 'í','ǐ','ì','i'), ('ū', 'ú','ǔ','ù','u'),('ǖ', 'ǘ','ǚ','ǜ','ü'));
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject); var i: integer; begin II := 0; //retrieves the keyboard layout handles corresponding to the current set of input locales in the system. iHandleCount := GetKeyboardLayoutList(20, pList); for i := 1 to iHandleCount do begin if ImmEscape(pList[i], 0, IME_ESC_IME_NAME, @szImeName) > 0 then if szImeName='微软拼音输入法' then begin
ii := i; exit; end; end; ShowMessage('请你安装"微软拼音输入法"!'); 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:\Program Files\KINGSOFT\XDICT\gb2py.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;
来自超级猛料