by Islam Mohamed Adel (3 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 26th June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
THIS IS HOW TO RUN AN .EXE FILE WITH THE PRIORITY YOU WANT, CHOOSE BETWEEN: IDLE, NORMAL, HIGH, REAL-TIME PRIORITY
API Declarations
'This is by: Islam Mohamed Adel
Private Declare Function GetPriorityClass Lib "kernel32" (ByVal hProcess As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Const PROCESS_QUERY_INFORMATION = &H400
Enum Priority
High = &H80
RealTime = &H100
Normal = &H20
Idle = &H40
End Enum
Enum ProgState
NormalFocus = vbNormalFocus
MaximizedFocus = vbMaximizedFocus
MinimizedFocus = vbMinimizedFocus
Hidden = vbHide
End Enum
Public Function Run(ExeFileName As String, Optional ProcessPriority As Priority = &H20, Optional ProgramState As ProgState = vbNormalFocus) As Boolean
Dim hProcess As Long
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(ExeFileName, ProgramState))
SetPriorityClass hProcess, ProcessPriority
Dim I As Long, S As String
I = GetPriorityClass(hProcess)
If I <> ProcessPriority Then GoTo ER:
Run = True
Exit Function
ER:
Run = False
End Function
No comments have been posted about THIS IS HOW TO RUN AN .EXE FILE WITH THE PRIORITY YOU WANT, CHOOSE BETWEEN: IDLE, NORMAL, HIGH, REA. Why not be the first to post a comment about THIS IS HOW TO RUN AN .EXE FILE WITH THE PRIORITY YOU WANT, CHOOSE BETWEEN: IDLE, NORMAL, HIGH, REA.