SetProcessAffinityMask 函数 The SetProcessAffinityMask function sets a processor affinity mask for the threads of the specified process. 定义 BOOL SetProcessAffinityMask(HANDLE hProcess, DWORD_PTR dwProcessAffinityMask); 参数 hProcess [in] Handle to the process whose affinity mask is to be set. This handle must have the PROCESS_SET_INFORMATION access right. For more information, see Process Security and Access Rights. dwProcessAffinityMask [in] Affinity mask for the threads of the process. 返回值 If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError. 说明 A process affinity mask is a bit vector in which each bit represents the processor on which the threads of the process are allowed to run.The value of the process affinity mask must be a proper subset of the system affinity mask values obtained by the GetProcessAffinityMask function.Do not call SetProcessAffinityMask in a DLL that may be called by processes other than your own.Process affinity is inherited by any child process or newly instantiated local process. 系统要求 Client: Requires Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0. Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0. Header: Declared in Winbase.h; include Windows.h. Library: Link to Kernel32.lib. DLL: Requires Kernel32.dll.
不过这个问题值得关注。判断双核可以用WMI,怎么关闭就不知道了
按照樓主的實踐,是有關系的。占個位置學習下
并且关CPU的也搞定了,哈哈
The SetProcessAffinityMask function sets a processor affinity mask for the threads of the specified process.
定义
BOOL SetProcessAffinityMask(HANDLE hProcess, DWORD_PTR dwProcessAffinityMask);
参数
hProcess
[in] Handle to the process whose affinity mask is to be set. This handle must have the PROCESS_SET_INFORMATION access right. For more information, see Process Security and Access Rights.
dwProcessAffinityMask
[in] Affinity mask for the threads of the process.
返回值
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError.
说明
A process affinity mask is a bit vector in which each bit represents the processor on which the threads of the process are allowed to run.The value of the process affinity mask must be a proper subset of the system affinity mask values obtained by the GetProcessAffinityMask function.Do not call SetProcessAffinityMask in a DLL that may be called by processes other than your own.Process affinity is inherited by any child process or newly instantiated local process.
系统要求
Client: Requires Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0.
Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.
Header: Declared in Winbase.h; include Windows.h.
Library: Link to Kernel32.lib.
DLL: Requires Kernel32.dll.
修改了DLL就搞定了,顺便也找到这个函数了