DELPHI XE7 [dcc32错误] E2250没有可以使用这些参数调用的'Pos'的重载版本

时间:2014-11-04 13:51:01

标签: delphi delphi-xe7 dcc32

在win7 32bit上的DELPHI XE7 代码:

procedure TForm1.IdMappedPortTCP1Execute(AContext: TIdContext);
begin
if (pos('CONNECT',AContext)<>0) or (pos('GET',AContext)<>0) or (pos('POST',AContext)<>0) or   (pos('HEAD',AContext)<>0)
then
(....)
sleep(100);
end;

错误:

[dcc32 Error] Unit1.pas(49): E2250 There is no overloaded version of 'Pos' that can be called with these arguments

请帮我解决该代码的问题

提前致谢

1 个答案:

答案 0 :(得分:4)

Pos的参数是两个字符串。这些函数搜索另一个字符串(第二个参数)中第一次出现的子字符串(第一个参数)。该功能记录在此处:http://docwiki.embarcadero.com/Libraries/en/System.Pos

您正在传递类型AContext的{​​{1}},而不是字符串。要修复代码,您需要传递包含您要搜索的文本的字符串。