Set a priority.CodeThere is no difference between it and the following: it is easy to use after a new one, and it is vague on the Internet. Write it down as a prompt to view it in the future or give it a result as needed.
Step 1: declare
Function long getpriorityclass (long hprocess) Library "kernel32.dll"
Function long setpriorityclass (long HPR, long class) Library "kernel32.dll"
Function long getcurrentprocess () Library "kernel32.dll"
Step 2: click a button to test the code
If the test window won't work out, it won't work.
Ulong lul_cp // currentProgramProcess Handle
Ulong lul_old_leval
Ulong lul_new_leval
Lul_new_levy = 128
Lul_cp = getcurrentprocess ()
Lul_old_leval = getpriorityclass (lul_cp) // get the level of the original process to see if the change was successful
Setpriorityclass (lul_cp, lul_new_leval)
PS:
1. The handle is different from the PID seen by the task manager. It took a long time to wander around here.
2. Level correspondence
32 low
64 Standard
128 high
256 Real-Time
3. If it fails, you can use the getlasterror API to check the returned value.