Hola julyus
Algo así pensé que era, te pongo la prueba que hice a ver si te orienta.(No dá ningún error)
Código Delphi
[-]
...
var
iMessageId: Integer;
implementation
procedure Prueba(aEventCode:array of Integer);
var
iCount: Integer;
begin
for iCount := 0 to Length(aEventCode) - 1 do
begin
if aEventCode[iCount] = 1 then
begin
inc(iMessageId);
end;
end;
end;
llamada:
Código Delphi
[-]
iMessageId:= 0;
Prueba([1,2,1,3]);
ShowMessage(IntToStr(iMessageId));
Seguramente hay algo más involucrado que está provocando el fallo.
Si es una funcion/procedimiento: ¿ que parámetro pasas al llamarla ?
Saludos.