delphi – 为什么我不能将resourcestring用作常量?
我从
http://embtvstools.svn.sourceforge.net/下载了embtvstools(Embarcadero TVirtualShellTools)
但是,当我创建一个新包时,删除.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,.....
更新 解决方法
正如Uwe在评论中指出的那样,Unicode版本的Delphi中的resourcestring属于WideString类型.但是您使用的是Unicode前Delphi,因此resourcestring只是AnsiString.这解释了编译错误.
如何进行取决于您尝试做什么.如果您打算将这些字符串翻译成不同的语言,那么您可能处于绑定状态.如果您打算这样做,那么使用Unicode版本的Delphi显然会好得多. 所以,既然你坚持使用Unicode之前的Delphi,我猜你实际上并不需要翻译字符串.在这种情况下,只需将const数组的声明从WideString更改为string.碰巧,此数组由此代码声明,但从未引用过. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |