Created
January 9, 2026 18:25
-
-
Save giraldeau/b56a33d9ea13417c90f55593edb5fa35 to your computer and use it in GitHub Desktop.
executable to show the process priority
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Generate using Gemini | |
| #include <iostream> | |
| #include <windows.h> | |
| int main() { | |
| // Get the handle of the current process | |
| HANDLE hProcess = GetCurrentProcess(); | |
| // Retrieve the priority class | |
| DWORD priority = GetPriorityClass(hProcess); | |
| if (priority == 0) { | |
| std::cerr << "Failed to get priority class. Error: " << GetLastError() << std::endl; | |
| return 1; | |
| } | |
| std::cout << "Current Process Priority Class: "; | |
| switch (priority) { | |
| case IDLE_PRIORITY_CLASS: std::cout << "Idle (Low)"; break; | |
| case BELOW_NORMAL_PRIORITY_CLASS: std::cout << "Below Normal"; break; | |
| case NORMAL_PRIORITY_CLASS: std::cout << "Normal"; break; | |
| case ABOVE_NORMAL_PRIORITY_CLASS: std::cout << "Above Normal"; break; | |
| case HIGH_PRIORITY_CLASS: std::cout << "High"; break; | |
| case REALTIME_PRIORITY_CLASS: std::cout << "Realtime"; break; | |
| default: std::cout << "Unknown (" << priority << ")"; break; | |
| } | |
| std::cout << std::endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment