【发布时间】:2010-01-12 11:43:16
【问题描述】:
我正在 Delphi 7 中开发一个 Word 插件,但很快我会将它升级到 Delphi 2010,如您所知,因为 2009 版 Delphi 引入了新的字符串类型 UnicodeString,它等于关键字 字符串 。另一方面,根据this thread,我们需要使用WideString 与COM 通信。
我的问题是,在当前使用 Delphi 7 进行开发的同时,我应该怎么做才能为将来的 Delphi 2010 做好准备?目前在我的代码中我使用用户定义的类型 UnicodeString,想法是当用 D7 编译时我的字符串是 WideString,当用 D2009 编译时它是 UnicodeString,我看到 Virtual TreeView 使用这种技术,如下代码:
{$ifndef COMPILER_12_UP}
type
UnicodeString = WideString;
PByte = PAnsiChar;
{$endif COMPILER_12_UP}
【问题讨论】:
-
我忘了提一个要求:目前在使用 D7 时,我需要使用 WideString 来支持 Unicode...