// string to PwideChar<br>function TEditGridColumn.StrToPWideChar(str: String): PWideChar;<br>var<br> pwc: PWideChar;<br>begin<br> GetMem(pwc, Length(str) * Sizeof(PwideChar) + 1);<br> result := StringToWideChar(str, pwc, Length(str) * SizeOf(WideChar) + 1);<br>end;<br><br><br>//是unicode码。在delphi中可以用如下函数转换。<br>//UniCode -> 汉字<br>function UniCode2Chinese(AiUniCode : Integer) : String;<br>var<br> ch, cl : string[3];<br> s : string;<br>begin<br> s := IntToHex(AiUniCode, 2);<br> cl := '$' + Copy(s, 1, 2);<br> ch := '$' + Copy(s, 3, 2);<br> s := Chr(StrToInt(ch)) + Chr(StrToInt(cl)) + #0;<br> Result := WideCharToString(pWideChar(s));<br>end;<br><br>//汉字 -> UniCode<br>function Chinese2UniCode(AiChinese : String) : Integer;<br>var<br> ch, cl : string[2];<br> a : array [1..2] of char;<br>begin<br> StringToWideChar(Copy(AiChinese, 1, 2), @(a[1]), 2);<br> ch := IntToHex(Integer(a[2]), 2);<br> cl := IntToHex(Integer(a[1]), 2);<br> Result := StrToInt('$' + ch + cl);<br>end;