update set_process_lowest_prio()
This commit is contained in:
+14
-8
@@ -5,14 +5,20 @@ if sys.platform[0:3] == 'win':
|
||||
from ctypes import wintypes
|
||||
|
||||
def set_process_lowest_prio():
|
||||
if sys.platform[0:3] == 'win':
|
||||
GetCurrentProcess = windll.kernel32.GetCurrentProcess
|
||||
GetCurrentProcess.restype = wintypes.HANDLE
|
||||
|
||||
SetPriorityClass = windll.kernel32.SetPriorityClass
|
||||
SetPriorityClass.argtypes = (wintypes.HANDLE, wintypes.DWORD)
|
||||
SetPriorityClass ( GetCurrentProcess(), 0x00000040 )
|
||||
|
||||
try:
|
||||
if sys.platform[0:3] == 'win':
|
||||
GetCurrentProcess = windll.kernel32.GetCurrentProcess
|
||||
GetCurrentProcess.restype = wintypes.HANDLE
|
||||
SetPriorityClass = windll.kernel32.SetPriorityClass
|
||||
SetPriorityClass.argtypes = (wintypes.HANDLE, wintypes.DWORD)
|
||||
SetPriorityClass ( GetCurrentProcess(), 0x00000040 )
|
||||
elif 'darwin' in sys.platform:
|
||||
os.nice(10)
|
||||
elif 'linux' in sys.platform:
|
||||
os.nice(20)
|
||||
except:
|
||||
print("Unable to set lowest process priority")
|
||||
|
||||
def set_process_dpi_aware():
|
||||
if sys.platform[0:3] == 'win':
|
||||
windll.user32.SetProcessDPIAware(True)
|
||||
Reference in New Issue
Block a user