Amjad Moustafa
أهلا وسهلا......
أنت غير مسجل لدينا كعضو في المنتدى ومع ذلك يمكنك إضافة المواضيع لإغناء النتدى

انضم إلى المنتدى ، فالأمر سريع وسهل

Amjad Moustafa
أهلا وسهلا......
أنت غير مسجل لدينا كعضو في المنتدى ومع ذلك يمكنك إضافة المواضيع لإغناء النتدى
Amjad Moustafa
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

تغيير أولوية أحد العمليات التي تعمل حاليا

اذهب الى الأسفل

تغيير أولوية أحد العمليات التي تعمل حاليا Empty تغيير أولوية أحد العمليات التي تعمل حاليا

مُساهمة  Amjad السبت 24 يناير 2015, 10:24 pm

'Module Code
Option Explicit

Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long

Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, lpdwProcessId As Long) As Long

Declare Function SetPriorityClass Lib _
"kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long

Public Const REALTIME_PRIORITY_CLASS = &H100
Public Const HIGH_PRIORITY_CLASS = &H80
Public Const NORMAL_PRIORITY_CLASS = &H20
Public Const IDLE_PRIORITY_CLASS = &H40

'Form Code
Private Sub Form_Load()
Dim lRet As Long
Dim lProcessID As Long
Dim lProcessHandle As Long

'You can replace me.hwnd with the handle of the
'window that you want to change its priority

GetWindowThreadProcessId Me.hwnd, lProcessID

'Get the process handled
lProcessHandle = OpenProcess(0, False, lProcessID)

'Sets the priority
'use any priority from the following (from the highest priority to the lowest):
'REALTIME_PRIORITY_CLASS
'HIGH_PRIORITY_CLASS
'NORMAL_PRIORITY_CLASS
'IDLE_PRIORITY_CLASS

'if lRet <> 0 then the changing operation action was successful

lRet = SetPriorityClass(lProcessHandle, HIGH_PRIORITY_CLASS)

'Close the handle so system retains
'accurate count of open handles
'to process. Returns non-zero if successful
lRet = CloseHandle(lProcessHandle)

End Sub

Amjad
Admin

عدد المساهمات : 71
تاريخ التسجيل : 07/11/2011

https://amjad-moustafa.rigala.net

الرجوع الى أعلى الصفحة اذهب الى الأسفل

الرجوع الى أعلى الصفحة


 
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى