Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Process priority setting
#4
Function GetProcessPriority
Code:
Copy      Help
;/
function# hwnd [flags]

;Gets priority class of a process (running program).
;On failure generates error.


;Returns one of x_PRIORITY_x constants:
;;;def NORMAL_PRIORITY_CLASS 0x00000020 ;;normal, default
;;;def IDLE_PRIORITY_CLASS 0x00000040 ;;lowest
;;;def HIGH_PRIORITY_CLASS 0x00000080
;;;def REALTIME_PRIORITY_CLASS 0x00000100 ;;highest, dangerous
;;;def BELOW_NORMAL_PRIORITY_CLASS 0x00004000 ;;*
;;;def ABOVE_NORMAL_PRIORITY_CLASS 0x00008000 ;;*
;;;;* not supported on NT/98/Me


;hwnd - handle of some window of that process.
;flags - 1 hwnd is process id.


;EXAMPLE
;out "0x%X" GetProcessPriority(win("Notepad"))



int pid ph pr
if(flags&1) pid=hwnd; else GetWindowThreadProcessId(hwnd &pid)
ph=OpenProcess(PROCESS_QUERY_X_INFORMATION 0 pid); if(!ph) goto g1
pr=GetPriorityClass(ph)
;g1
if(!pr) _s.dllerror
if(ph) CloseHandle ph
if(!pr) end _s
ret pr


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)