1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Liest alle 0.5 Sekunden die Prozesspriorität aus
Dim CurrentApp As Process
Try
CurrentApp = Process.GetCurrentProcess
Select Case CurrentApp.PriorityClass
Case ProcessPriorityClass.Idle
lblGetPriority.Text = "STATUS: Priority = " & ProcessPriorityClass.Idle.ToString
Case ProcessPriorityClass.BelowNormal
lblGetPriority.Text = "STATUS: Priority = " & ProcessPriorityClass.BelowNormal.ToString
Case ProcessPriorityClass.Normal
lblGetPriority.Text = "STATUS: Priority = " & ProcessPriorityClass.Normal.ToString
Case ProcessPriorityClass.AboveNormal
lblGetPriority.Text = "STATUS: Priority = " & ProcessPriorityClass.AboveNormal.ToString
Case ProcessPriorityClass.High
lblGetPriority.Text = "STATUS: Priority = " & ProcessPriorityClass.High.ToString
Case ProcessPriorityClass.RealTime
lblGetPriority.Text = "STATUS: Priority = " & ProcessPriorityClass.RealTime.ToString
End Select
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub btnSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSet.Click
Dim CurrentApp As Process
CurrentApp = Process.GetCurrentProcess
Try
'Wleche Button wurde gedrueckt
If RadioButton1.Checked = True Then
CurrentApp.PriorityClass = ProcessPriorityClass.Idle
ElseIf RadioButton2.Checked = True Then
CurrentApp.PriorityClass = ProcessPriorityClass.BelowNormal
ElseIf RadioButton3.Checked = True Then
CurrentApp.PriorityClass = ProcessPriorityClass.Normal
ElseIf RadioButton4.Checked = True Then
CurrentApp.PriorityClass = ProcessPriorityClass.AboveNormal
ElseIf RadioButton5.Checked = True Then
CurrentApp.PriorityClass = ProcessPriorityClass.High
ElseIf RadioButton6.Checked = True Then
CurrentApp.PriorityClass = ProcessPriorityClass.RealTime
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'beim laden wird "Normal" als Standard gesetzt
RadioButton3.Checked = True
End Sub
End Class
|