我已经下载embtvstools
(Embarcadero公司TVirtualShellTools)来源:http://embtvstools.svn.sourceforge.net/为什么我不能使用资源字符串作为常量?
然而,当我创建一个新包,丢弃的.pas文件(从VirtualTreeView在缺少compilers.inc
)和编译很多,我得到一个错误E2026,这是为什么,我该如何避免/解决这个问题?
resourcestring
sAssociationChanged = 'Association Changed';
sItemCreate = 'Item Create';
sItemDelete = 'Item Delete';
....
const
// Literal translations of TShellNotifyEvent type. Useful when using the
// OnShellNotify event to print out what event occurred. VirtualShellUtilities.pas
// has a helper function ShellNotifyEventToStr that uses these.
VET_NOTIFY_EVENTS: array[0..19] of WideString = (
sAssociationChanged,
sAttributes,
sItemCreate,
.....
[帕斯卡错误] IDEVirtualResources.pas(155):E2026常量表达式预期
[帕斯卡错误] IDEVirtualResources.pas(156):E2026常量表达式预期
[帕斯卡错误] IDEVirtualResources。 PAS(157):E2026常量表达式预期
更新
更改widestring
到string
停止编译器抱怨,(我怀疑它会在其他地方产生一些问题,因为宽字符串<>字符串)我想保留类型为widestring
的常量。
该代码可能适用于D2009 +,其中资源字符串是WideStrings。 –
对于它的价值,D2009和D2010不会抱怨这一点。可能与Unicode有关。 WideStrings毕竟是Windows管理的UTF-16LE字符串...并且在D2009之前的资源串是AnsiStrings。 –
我不得不说,我甚至觉得你甚至可以有一个类型为'WideString'的常量。它们是真正的'WideStrings'在运行时与COM分配器分配,还是只是指向以NULL结尾的WideChar数组? –