Einzelnen Beitrag anzeigen

alfold

Registriert seit: 29. Jun 2010
Ort: Neustrelitz
393 Beiträge
 
Delphi 7 Enterprise
 
#1

Result als mehrdimensoiertes array im Thread

  Alt 3. Jan 2017, 15:39
Delphi-Version: 7
Hi, zur Zeit hänge ich an dieses Problem.

Ich bekomme im Mainthread immer ein leeres array zurück!
Im thread selbst wird es gefüllt.

Nun weiß ich nicht mehr weiter!

Delphi-Quellcode:
...
.....

type
  tarray = array[1..4] of array of Boolean;
....
....
private
  fisfilea: tarray;/
  .....
  .....
  function Getfile: tarray;


public
   property isfile: tarray read Getfile;
....
....


procedure TLwThread.Execute;
var
  i, x: Integer;
begin
    try
        while not Terminated do
        begin

            if (WaitForSingleObject(FEvent, INFINITE) = WAIT_OBJECT_0) and not Terminated then
            begin
               for i:= 1 to 4 do
               begin
                   if FileList[i].Count > 0 then
                    begin
                        for x:= 0 to FileList[i].Count -1 do
                        begin
                            if FileExists(FileList[i].Strings[x]) then
                               fisfilea[i][x]:= True
                            else
                               fisfilea[i][x]:= False;

                         end;
                     end;

               end;
              // Getfile;
            end;
            Sleep(1);
        end;

    except
        Finished;
    end;
.....
.....
.....

function TLwThread.Getfile: tarray;
var
  i, x: Integer;
begin
    for i:= 1 to 4 do
    begin
       SetLength(Result[i], Length(fisfilea[i]));
       //for x:= 0 to high(Result[i]) do
       begin
           Result[i]:= Copy(fisfilea[i]);


       end;
    end;
    // if Length(fisfilea[1]) > 0 then
   // Result:=fisfilea;
end;
Dabei hab ich festgestellt,
das "wahrscheinlich" das array in der function Getfile leer ist, obwohl es in execute gefühlt wird.

Allerdings weiß ich auch nicht so recht wie die Übergabe erfolgt!

wer kann da helfen

Gruß
  Mit Zitat antworten Zitat