Hast du dir mal angeschaut, was die einzelnen Parameter für BeginThread bedeuten?
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
PInteger = ^Integer;
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function Test (a: PInteger): 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, @I, 0, ID);
end;
end.
So sollte es laufen.