| 1 | #include <MsgBoxConstants.au3> |
|---|
| 2 | #include <WinAPIProc.au3> |
|---|
| 3 | #include <APIProcConstants.au3> |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | Example() |
|---|
| 7 | |
|---|
| 8 | Func Example() |
|---|
| 9 | |
|---|
| 10 | ; run notepad |
|---|
| 11 | Run("notepad.exe") |
|---|
| 12 | Local $iPID = ProcessWait("notepad.exe") |
|---|
| 13 | |
|---|
| 14 | ; get Priority Description |
|---|
| 15 | Local $sPriorityDesc = Example_WinAPI_GetPriorityClass($iPID) |
|---|
| 16 | |
|---|
| 17 | ; show the message |
|---|
| 18 | If Not @error Then |
|---|
| 19 | MsgBox($MB_SYSTEMMODAL, Hex(@extended), $sPriorityDesc) |
|---|
| 20 | Else |
|---|
| 21 | MsgBox(0, "Failure", "_WinAPI_GetPriorityClass") |
|---|
| 22 | EndIf |
|---|
| 23 | |
|---|
| 24 | ; CleanUp |
|---|
| 25 | ProcessClose($iPID) |
|---|
| 26 | |
|---|
| 27 | EndFunc ;==>Example |
|---|
| 28 | |
|---|
| 29 | Func Example_WinAPI_GetPriorityClass($iPID) |
|---|
| 30 | |
|---|
| 31 | ; Check Priorrity |
|---|
| 32 | Local $Class = _WinAPI_GetPriorityClass($iPID) |
|---|
| 33 | If Not $Class Then |
|---|
| 34 | Return SetError(1) |
|---|
| 35 | EndIf |
|---|
| 36 | |
|---|
| 37 | ; setting return value |
|---|
| 38 | Switch $Class |
|---|
| 39 | Case $ABOVE_NORMAL_PRIORITY_CLASS |
|---|
| 40 | Return SetError(0, $ABOVE_NORMAL_PRIORITY_CLASS, "ABOVE_NORMAL_PRIORITY_CLASS") |
|---|
| 41 | Case $BELOW_NORMAL_PRIORITY_CLASS |
|---|
| 42 | Return SetError(0, $BELOW_NORMAL_PRIORITY_CLASS, "BELOW_NORMAL_PRIORITY_CLASS") |
|---|
| 43 | Case $HIGH_PRIORITY_CLASS |
|---|
| 44 | Return SetError(0, $HIGH_PRIORITY_CLASS, "HIGH_PRIORITY_CLASS") |
|---|
| 45 | Case $IDLE_PRIORITY_CLASS |
|---|
| 46 | Return SetError(0, $IDLE_PRIORITY_CLASS, "IDLE_PRIORITY_CLASS") |
|---|
| 47 | Case $NORMAL_PRIORITY_CLASS |
|---|
| 48 | Return SetError(0, $NORMAL_PRIORITY_CLASS, "NORMAL_PRIORITY_CLASS") |
|---|
| 49 | Case $REALTIME_PRIORITY_CLASS |
|---|
| 50 | Return SetError(0, $REALTIME_PRIORITY_CLASS, "REALTIME_PRIORITY_CLASS") |
|---|
| 51 | EndSwitch |
|---|
| 52 | EndFunc ;==>Example_WinAPI_GetPriorityClass |
|---|