Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Mar : CreateThread and class function

www.cryer.info
Managed Newsgroup Archive

CreateThread and class function

Subject:CreateThread and class function
Posted by:"Tobias" (tobias_..@hotmail.com)
Date:Mon, 12 Mar 2007 12:55:06

Hello!

I need to create a thread that takes a pointer to a Class function.
Is this possible?


Ex:

Type
  TTest = class

  function Thread1(p: Pointer) : DWORD;

  procedure CreateThread;

end;

procedure TTest.CreateThread;
begin
  CreateThread(...Thread1...);
end;

I tryed this but get an excepiont when reading data from the class in ther
thread.

Type
  TThreadPointer = function(p : Pointer) : DWORD of object;
TTest = class
  pThread : Pointer;
  function Thread1(p: Pointer) : DWORD;

  procedure CreateThread;

end;

procedure TTest.CreateThread;
begin
pThread   := Thread1;
CreateThread(...pThread...);
end;

Replies:

www.cryer.info
Managed Newsgroup Archive