问题有以下两个:1、
aa:string;
aa:='319 010820 018 257 8 1 200 0.5469 1100 0.5469 200 0.6999 300 0.7999 400 0.8999 800 50 20 2000 888888 999999 3200000120090613230230ZHANGXH 40 1282310 90085703 ';当编译时,出现提示:[Error] Unit1.pas(257): String literals may have at most 255 elements。是什么意思,把aa:string; 改为 aa:ansistring; 提示还是一样。
2、
hDevice:THANDLE;
..
if (hDevice=-1) then
编译时提示末句处:
[Warning] Unit1.pas(115): Comparison always evaluates to False
[Warning] Unit1.pas(115): Comparing signed and unsigned types - widened both operands这是什么意思,如何处理
aa:string;
aa:='319 010820 018 257 8 1 200 0.5469 1100 0.5469 200 0.6999 300 0.7999 400 0.8999 800 50 20 2000 888888 999999 3200000120090613230230ZHANGXH 40 1282310 90085703 ';当编译时,出现提示:[Error] Unit1.pas(257): String literals may have at most 255 elements。是什么意思,把aa:string; 改为 aa:ansistring; 提示还是一样。
2、
hDevice:THANDLE;
..
if (hDevice=-1) then
编译时提示末句处:
[Warning] Unit1.pas(115): Comparison always evaluates to False
[Warning] Unit1.pas(115): Comparing signed and unsigned types - widened both operands这是什么意思,如何处理
'800 50 20 2000 888888 999999 3200000120090613230230ZHANGXH 40 1282310 90085703 ';
所以用 "+" 换行;3:是警告,一般不会编译出错; 你那 if 语句 永远不会为true;总是返回false;
说你 用了 一个 有符号的和一个没符号 的做比较!你类型改成 integer 就可以啦
implementation{$R *.dfm}
{$H+} //加上这个,显式定义String类型可以超过255个字符。如有{$H-}这样去掉。
a.可寫類似:
'fasdfasdfasfasdfasdfasd'+
'fadsfasdfadsfasdfrewfqewf'....形式;b.修改一下這裡:
$R *.dfm}
{$H+} 2.LONGWORD是無符類型,不能小於0;可以定義成integer來作判斷
放个按钮,点击代码如下侦测某一个编译开关的作用状态
{$ifopt H+}
ShowMessage('H+');
{$else}
ShowMessage('H-');
{$endif}{$H+} 就是 Huge String就能超过255
如果不在代码里显式打开编译器开关,那么你可以
Project/Options/Compiler 有个Huge Strings选框选中,Rebuild你的工程应该就不会报这个错误了