📄 frm_main.frm
字号:
VERSION 5.00
Begin VB.Form frm_main
BorderStyle = 1 'Fixed Single
Caption = "testmultiThread"
ClientHeight = 5055
ClientLeft = 45
ClientTop = 405
ClientWidth = 7455
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5055
ScaleWidth = 7455
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "关于(&A)"
Height = 375
Left = 6120
TabIndex = 18
Top = 4560
Width = 1215
End
Begin VB.Frame F
Caption = "线程[2]"
Height = 1335
Index = 2
Left = 120
TabIndex = 16
Top = 3120
Width = 7215
Begin VB.CommandButton cTerminateThread
Caption = "TerminateThread"
Height = 375
Index = 2
Left = 5280
TabIndex = 12
Top = 720
Width = 1695
End
Begin VB.CommandButton cResumeThread
Caption = "ResumeThread"
Height = 375
Index = 2
Left = 3600
TabIndex = 11
Top = 720
Width = 1575
End
Begin VB.CommandButton cSuspendThread
Caption = "SuspendThread"
Height = 375
Index = 2
Left = 1800
TabIndex = 10
Top = 720
Width = 1695
End
Begin VB.CommandButton cCreateThread
Caption = "CreateThread"
Height = 375
Index = 2
Left = 120
TabIndex = 9
Top = 720
Width = 1575
End
Begin VB.PictureBox Pic
Height = 255
Index = 2
Left = 120
ScaleHeight = 13
ScaleMode = 3 'Pixel
ScaleWidth = 453
TabIndex = 17
Top = 240
Width = 6855
End
Begin amicMultiThread.mThreadControl mThread
Index = 2
Left = 2280
Top = 0
_ExtentX = 3466
_ExtentY = 423
End
End
Begin VB.Frame F
Caption = "线程[1]"
Height = 1335
Index = 1
Left = 120
TabIndex = 14
Top = 1680
Width = 7215
Begin VB.CommandButton cTerminateThread
Caption = "TerminateThread"
Height = 375
Index = 1
Left = 5280
TabIndex = 8
Top = 720
Width = 1695
End
Begin VB.CommandButton cResumeThread
Caption = "ResumeThread"
Height = 375
Index = 1
Left = 3600
TabIndex = 7
Top = 720
Width = 1575
End
Begin VB.CommandButton cSuspendThread
Caption = "SuspendThread"
Height = 375
Index = 1
Left = 1800
TabIndex = 6
Top = 720
Width = 1695
End
Begin VB.CommandButton cCreateThread
Caption = "CreateThread"
Height = 375
Index = 1
Left = 120
TabIndex = 5
Top = 720
Width = 1575
End
Begin VB.PictureBox Pic
Height = 255
Index = 1
Left = 120
ScaleHeight = 13
ScaleMode = 3 'Pixel
ScaleWidth = 453
TabIndex = 15
Top = 240
Width = 6855
End
Begin amicMultiThread.mThreadControl mThread
Index = 1
Left = 2280
Top = 0
_ExtentX = 3466
_ExtentY = 423
End
End
Begin VB.Frame F
Caption = "线程[0]"
Height = 1335
Index = 0
Left = 120
TabIndex = 0
Top = 240
Width = 7215
Begin VB.PictureBox Pic
Height = 255
Index = 0
Left = 120
ScaleHeight = 13
ScaleMode = 3 'Pixel
ScaleWidth = 453
TabIndex = 13
Top = 240
Width = 6855
End
Begin VB.CommandButton cCreateThread
Caption = "CreateThread"
Height = 375
Index = 0
Left = 120
TabIndex = 1
Top = 720
Width = 1575
End
Begin VB.CommandButton cSuspendThread
Caption = "SuspendThread"
Height = 375
Index = 0
Left = 1800
TabIndex = 2
Top = 720
Width = 1695
End
Begin VB.CommandButton cResumeThread
Caption = "ResumeThread"
Height = 375
Index = 0
Left = 3600
TabIndex = 3
Top = 720
Width = 1575
End
Begin VB.CommandButton cTerminateThread
Caption = "TerminateThread"
Height = 375
Index = 0
Left = 5280
TabIndex = 4
Top = 720
Width = 1695
End
Begin amicMultiThread.mThreadControl mThread
Index = 0
Left = 2280
Top = 0
_ExtentX = 3466
_ExtentY = 423
End
End
End
Attribute VB_Name = "frm_main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub cCreateThread_Click(Index As Integer)
mThread(Index).CreateThread 0, 0 '创建
End Sub
Private Sub Command1_Click()
mThread(0).about
End Sub
Private Sub cResumeThread_Click(Index As Integer)
mThread(Index).ResumeThread '恢复
End Sub
Private Sub cSuspendThread_Click(Index As Integer)
mThread(Index).SuspendThread '挂起
End Sub
Private Sub cTerminateThread_Click(Index As Integer)
mThread(Index).TerminateThread '结束--最好不用这方法
End Sub
Private Sub mThread_RunThread(Index As Integer, ByVal lpParam As Long)
Dim i As Integer
Do
i = i + 1
Pic(Index).Cls
Pic(Index).Line (i, 0)-(i, Pic(Index).ScaleHeight)
Sleep 10
If i > Pic(Index).ScaleWidth Then i = 0
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -