【发布时间】:2011-10-06 16:39:15
【问题描述】:
我在 [Code] 中有 GetVersion 函数,它返回一个类似“1004”、“1003”等的字符串。
我创建了这个函数来检查最低版本号的注册表值并卸载它们。
这是代码的 sn-p,它为 StrtoInt 转换行提供错误点说明
Comma (,) expected
这里是sn-p:
function DoesOldVersionsExist(): Boolean;
var
AppVersion: integer;
mstr: string;
VersionInstalled: cardinal;
begin
AppVersion := StrToInt(GetVersion({#MyAppVersion}), 0);
...
在那一行之后,我简单地比较这些值并返回真或假。非常感谢。
这是错误消息的内容:
Line 55
Column 40.
Comma (,) expected
感谢迪安娜,但不幸的是,这是指向此的错误消息:
AppVersion := StrToInt(GetVersion({#MyAppVersion}), 0);
^
这里是 GetVersion 函数:
function GetVersion(AppVersion: String): String;
var
Version: String;
CharIndex: integer;
c: char;
begin
for CharIndex := 1 to Length(AppVersion) do begin
c := AppVersion[CharIndex];
if (c <> '.') then
Version := Version + c;
end;
Result := Version;
end;
【问题讨论】:
-
你的右括号好像太多了。
-
当您收到错误消息时,也请尝试发布它,因为它通常会提供有关问题所在的线索。
-
很好,我改变了它仍然没有运气。我会编辑我的问题谢谢。
-
与您的previous question 一样,您还没有告诉我们 MyAppVErsion 的定义是什么。这对这两个问题都至关重要,因为它在所有情况下都被完全按照原样使用。您需要确保它是“干净的”特殊字符并根据需要将其引用为代码/脚本中的文字。在我们知道那个值是什么之前,我们所做的只是猜测。
-
#define MyAppVersion GetFileVersion("Release\myFile.dll") 版本看起来像这样“1.0.0.3”
标签: inno-setup pascal