Ver Mensaje Individual
  #8  
Antiguo 31-12-2008
Avatar de Kipow
Kipow Kipow is offline
Miembro
 
Registrado: abr 2006
Ubicación: Guatemala
Posts: 329
Reputación: 21
Kipow Va por buen camino
Código Delphi [-]
unit exthread;

interface

uses
  Classes, types, Sysutils, Windows;

type
  TExThread = class(TThread)
  private
    FAffinityMask: DWord;
    procedure SetAffinity(const Value: DWord);
    { Private declarations }
  protected
    procedure Execute; override;
  public
    property AffinityMask : DWord read FAffinityMask write SetAffinity;
  end;

implementation

{ Important: Methods and properties of objects in VCL can only be used in a
  method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure TExThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ TExThread }

procedure TExThread.Execute;
begin
  { Place thread code here }
end;

procedure TExThread.SetAffinity(const Value: DWord);
begin
  FAffinityMask := SetThreadAffinityMask(Handle,Value);
  if FAffinityMask = 0 then raise Exception.Create('Error setting thread affinity mask : ' + IntToStr(GetLastError));
end;

end.
Solo tenes que guardar el codigo en una unidad nueva llamada exthread.pas y listo. (solo le hacian falta unas unidades en el uses)
Responder Con Cita