Actually like this:
Delphi-Quellcode:
FUNCTION SetProcessorNr(Nr : Byte) : Boolean; {0 until 31}
VAR Process : THandle;
BEGIN
Process:=GetCurrentProcess;
Result:=SetProcessAffinityMask(Process, (1 SHL Nr));
END;
This function must run within a FOR-TO-DO loop to set the processors. The number of processors (which is part of the FOR-TO-DO loop) can be detected by using the GetSystemInfo function (
here), where the SYSTEM_INFO structure (
here again) contains the value dwNumberOfProcessors as DWord.
Hope that helps.