📄 form1.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1
BackColor = &H00000000&
BorderStyle = 3 'Fixed Dialog
Caption = "进程调度例程序"
ClientHeight = 7140
ClientLeft = 45
ClientTop = 435
ClientWidth = 10260
LinkTopic = "Form1"
Picture = "Form1.frx":0000
ScaleHeight = 7140
ScaleWidth = 10260
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.Timer Timer4
Interval = 50
Left = 9360
Top = 4080
End
Begin VB.ListBox List1
Height = 1425
Left = 480
TabIndex = 22
Top = 3480
Width = 6135
End
Begin VB.Timer Timer3
Enabled = 0 'False
Interval = 50
Left = 8760
Top = 4080
End
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 50
Left = 8160
Top = 4080
End
Begin VB.Frame Frame4
BackColor = &H00000000&
Caption = "执行状态"
ForeColor = &H00FFFFFF&
Height = 1335
Left = 480
TabIndex = 14
Top = 5520
Width = 6135
Begin MSComctlLib.ProgressBar PBar1
Height = 375
Left = 1200
TabIndex = 18
Top = 720
Visible = 0 'False
Width = 4455
_ExtentX = 7858
_ExtentY = 661
_Version = 393216
Appearance = 0
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
ForeColor = &H00FFFFFF&
Height = 255
Left = 1200
TabIndex = 19
Top = 360
Width = 1455
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Height = 435
Left = 1200
TabIndex = 17
Top = 240
Width = 4245
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "当前进程"
ForeColor = &H8000000E&
Height = 255
Left = 120
TabIndex = 16
Top = 360
Width = 975
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "完成数"
ForeColor = &H8000000E&
Height = 255
Left = 120
TabIndex = 15
Top = 840
Width = 735
End
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 50
Left = 7440
Top = 4080
End
Begin MSComctlLib.ListView PPCB
Height = 3015
Left = 480
TabIndex = 8
Top = 240
Width = 6135
_ExtentX = 10821
_ExtentY = 5318
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.Frame Frame2
BackColor = &H00E0E0E0&
Caption = "参数设置"
Height = 3855
Left = 7080
TabIndex = 2
Top = 240
Width = 2775
Begin VB.TextBox Text3
Height = 285
Left = 1800
TabIndex = 13
Text = "20"
Top = 1200
Width = 615
End
Begin VB.TextBox Text2
Height = 285
Left = 1800
TabIndex = 9
Text = "3"
Top = 360
Width = 615
End
Begin VB.Frame Frame3
BackColor = &H00E0E0E0&
Caption = "调度算法"
Height = 1815
Left = 240
TabIndex = 5
Top = 1680
Width = 2295
Begin VB.OptionButton Fcfs
BackColor = &H00E0E0E0&
Caption = "先来先服务"
Height = 195
Left = 120
TabIndex = 20
Top = 1320
Width = 1335
End
Begin VB.OptionButton Priority
BackColor = &H00E0E0E0&
Caption = "优先级法"
Height = 195
Left = 120
TabIndex = 7
Top = 840
Width = 1215
End
Begin VB.OptionButton Round
BackColor = &H00E0E0E0&
Caption = "轮转法"
Height = 195
Left = 120
TabIndex = 6
Top = 360
Value = -1 'True
Width = 855
End
End
Begin VB.TextBox Text1
Height = 285
Left = 1800
TabIndex = 3
Text = "5"
Top = 840
Width = 615
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "时间片长度范围(>3)"
Height = 255
Left = 240
TabIndex = 12
Top = 1200
Width = 1815
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "CPU时间片长度"
Height = 255
Left = 240
TabIndex = 10
Top = 360
Width = 1455
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "模拟进程数量"
Height = 255
Left = 240
TabIndex = 4
Top = 840
Width = 1215
End
End
Begin VB.Frame Frame1
BackColor = &H00000000&
Caption = "控制命令"
ForeColor = &H00FFFFFF&
Height = 2415
Left = 7080
TabIndex = 0
Top = 4440
Width = 2775
Begin VB.CommandButton Command2
Caption = "Restart"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1560
TabIndex = 23
Top = 480
Width = 975
End
Begin VB.CommandButton Command1
Caption = "END"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1560
TabIndex = 21
Top = 1440
Width = 975
End
Begin VB.CommandButton Run
Caption = "RUN"
BeginProperty Font
Name = "Arial Black"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 240
TabIndex = 11
Top = 1440
Width = 975
End
Begin VB.CommandButton CreatProcess
BackColor = &H8000000D&
Caption = "Creat"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 240
MaskColor = &H00FFFFFF&
TabIndex = 1
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Chip As Integer
Dim PreTop As Integer
Dim CurTop As Integer
Dim TimeChip As Integer 'CPU单位时间
Dim Pslice As Integer 'CPU时间片长度(轮转法),优先级法用于进度条
Dim proc() As PCB '存放随机模拟进程的PCB
Dim ProcBak() As PCB '备份随机模拟进程的PCB
Dim ProcReady() As PCB '存放就绪进程的PCB
Dim ProcFinish() As PCB '存放完成进程的PCB
'Dim ProcExe As Integer '存放执行进程的ID
Dim PNum As Integer '模拟进程数量
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
Form_Load
Form1.Refresh
End Sub
Private Sub Form_Load()
List1.Clear
PPCB.ListItems.Clear '窗口加载,初始化
Label7.Caption = ""
PBar1.Visible = False
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
PPCB.ColumnHeaders.Clear
PPCB.ColumnHeaders.Add , , "进程名称", 1000
PPCB.ColumnHeaders.Add , , " 需要的时间片 ", 1400
PPCB.ColumnHeaders.Add , , " 使用的时间片 ", 1400
PPCB.ColumnHeaders.Add , , " 进程状态 ", 1000
End Sub
Private Sub CreatProcess_Click()
Dim Limit As Integer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -