一)本文的目的:
本文主要介绍如何调用系统库函数获取汉字的拼音。
二)具体实现:
主要用到类CPtiEngine及对应的库ptiengine.lib,头文件#include <ptiengine.h>
1)打开字库
TBool CFindUtilChinese::OpenT9InterfaceL(TLanguage aLanguage)
{
if (!iPtiEngine)
{
iPtiEngine = CPtiEngine::NewL();
}
if (aLanguage != iLanguage)
{
iPtiEngine->ActivateLanguageL(iLanguage);
iPtiEngine->EnableToneMarks(EFalse);
}
return ETrue;
}
2)关闭字库
void CFindUtilChinese::CloseT9InterfaceL()
{
iLanguage = ELangTest;
iPtiEngine->CloseCurrentLanguageL();
}
3)调用CPtiEngine::GetSpelling (TUint16 aInput, TDes &aOutput, TPtiSpelling aType)
//函数的SDK介绍
IMPORT_C TInt CPtiEngine::GetSpelling ( TUint16 aInput,
TDes & aOutput,
TPtiSpelling aType
)
Returns alternate spelling for given character.
Parameters:
aInput a character to be converted to requested spelling.
aOutput output will be stored to this descriptor.
aType spelling type
Returns:
KErrNone if operation was successful, KErrNotSupported if requested spelling type is not supported.