Beomagi Posted November 4, 2011 Posted November 4, 2011 I have a process set to run on cpu 1 and 3 (out of 4 virtual 'cores'). When I run the _WinAPI_GetProcessAffinityMask, It returns successful, but mask is 0 for any process. #include <Process.au3> #include <WinAPI.au3> If ProcessExists("vlc.exe") Then $list = ProcessList("vlc.exe") For $i = 1 To $list[0][0] $Priority = _ProcessGetPriority($list[$i][1]) $affiity = _WinAPI_GetProcessAffinityMask($list[$i][1]) MsgBox(0, $list[$i][0]&":"&$list[$i][1], "Priority:" & $Priority & @CRLF & "Success:" & $affiity[0] & @CRLF & "Proc Mask:" & $affiity[1] & @CRLF & "Sys Mask:" & $affiity[2]) Next EndIf Any ideas? I'm using windows 7 pro 32bit.
KaFu Posted November 4, 2011 Posted November 4, 2011 You're calling the function with the PID, but you should call it with a process handle. #include <Process.au3> #include <WinAPI.au3> $Priority = _ProcessGetPriority(@AutoItPID) $hCurrentProcess = _WinAPI_GetCurrentProcess() $affiity = _WinAPI_GetProcessAffinityMask($hCurrentProcess) MsgBox(0, "", "Priority:" & $Priority & @CRLF & "Success:" & $affiity[0] & @CRLF & "Proc Mask:" & $affiity[1] & @CRLF & "Sys Mask:" & $affiity[2]) Look for examples on _WinAPI_OpenProcess() to obtain a process handle for other processes... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now