Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#12

Re: Funktion mit Paramtern in einem Thread

  Alt 5. Mai 2010, 15:48
Jo so würd ichs bei Records machen. Aber bei kleineren Datentypen (<= 32 Bit) ist ein Cast auf einen Pointer einfacher.

Delphi-Quellcode:
Function Test (a: Integer): Integer;
begin
  ShowMessage(IntToStr(a));
  Result := a;
end;

procedure TForm1.FormCreate(Sender: TObject);
var ID: Cardinal;
    Handle: THandle;
    I: Integer;
begin
  i := 20;
  Handle := BeginThread(nil, 0, @Test, Pointer(I), 0, ID);
end;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat