查询汉字拼音码的问题

phoenix_l 2005-10-10 04:53:44
抓狂了,在安装了微软拼音输入法2003之后,ImmGetConversionList函数就只能返回0了。这到底是怎么回事?
...全文
187 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
JACKEY 2005-11-08
  • 打赏
  • 举报
回复
看看获取汉字拼音组件 v4.1
相关代码:
function GetHzPy(HzChar: PChar; Len: Integer): String;
var
C: Char;
Index: Integer;
begin
Result := '';
if (Len > 1) and (HzChar[0] >= #129) and (HzChar[1] >= #64) then
begin
//是否为 GBK 字符
case HzChar[0] of
#163: // 全角 ASCII
begin
C := Chr(Ord(HzChar[1]) - 128);
if C in ['a'..'z', 'A'..'Z', '0'..'9', '(', ')', '[', ']'] then
Result := C
else
Result := '';
end;
#162: // 罗马数字
begin
if HzChar[1] > #160 then
Result := CharIndex[Ord(HzChar[1]) - 160]
else
Result := '';
end;
#166: // 希腊字母
begin
if HzChar[1] in [#$A1..#$B8] then
Result := CharIndex2[Ord(HzChar[1]) - $A0]
else if HzChar[1] in [#$C1..#$D8] then
Result := CharIndex2[Ord(HzChar[1]) - $C0]
else
Result := '';
end;
else
begin // 获得拼音索引
Index := PyCodeIndex[Ord(HzChar[0]) - 128, Ord(HzChar[1]) - 63];
if Index = 0 then
Result := ''
else
Result := PyMusicCode[Index];
end;
end;
end
else if Len > 0 then
begin
//在 GBK 字符集外, 即半角字符
if HzChar[0] in ['a'..'z', 'A'..'Z', '0'..'9', '(', ')', '[', ']',
'.', '!', '@', '#', '$', '%', '^', '&', '*', '-', '+',
'<', '>', '?', ':', '"'] then
Result := HzChar[0]
else
Result := '';
end;
end;
phoenix_l 2005-10-10
  • 打赏
  • 举报
回复
我这里的机器都装了office2003的,所以没有办法试。:(

我的目的就是想取得汉字的拼音码,使用微软的拼音输入法,在以下的语句中:
if ImmGetConversionList(Hkb, 0, PChar(myString), @szBuffer, SizeOf(szBuffer), GCL_REVERSECONVERSION) > 0 then 判断的时候,每次这个语句都返回0,简直让人郁闷啊。
leonkim 2005-10-10
  • 打赏
  • 举报
回复
呵,没遇到过。楼主在别的机器上试试呢?

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧