
vb 请问如果停止程序
PrivateDeclareFunctionGetAsyncKeyStateLib"user32"(ByValvKeyAsLong)AsInteger'声明Private...
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
'声明
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
'延时
Private Sub Delay(ByVal num As Integer)
Dim t As Long
t = timeGetTime
Do Until timeGetTime - t >= num * 1000
DoEvents
Loop
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKey1) Then 'Ctrl+1
For i = 1 To 100
Delay 1
Static s As Integer
s = s + 1
Me.Caption = s
Next
End If
End Sub
不好意思。如果我用'Ctrl+1运行程序时。过程我想停止。 展开
'声明
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
'延时
Private Sub Delay(ByVal num As Integer)
Dim t As Long
t = timeGetTime
Do Until timeGetTime - t >= num * 1000
DoEvents
Loop
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKey1) Then 'Ctrl+1
For i = 1 To 100
Delay 1
Static s As Integer
s = s + 1
Me.Caption = s
Next
End If
End Sub
不好意思。如果我用'Ctrl+1运行程序时。过程我想停止。 展开
3个回答
展开全部
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
'声明
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
'延时
Dim sc As Integer
Private Sub Delay(ByVal num As Integer)
Dim t As Long
t = timeGetTime
Do Until timeGetTime - t >= num * 1000
DoEvents
Loop
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
sc = 1
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKey1) Then 'Ctrl+1
For i = 1 To 100
Delay 1
Static s As Integer
s = s + 1
Me.Caption = s
If sc = 1 Then Exit For
Next
End If
End Sub
按Command1
'声明
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
'延时
Dim sc As Integer
Private Sub Delay(ByVal num As Integer)
Dim t As Long
t = timeGetTime
Do Until timeGetTime - t >= num * 1000
DoEvents
Loop
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
sc = 1
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKey1) Then 'Ctrl+1
For i = 1 To 100
Delay 1
Static s As Integer
s = s + 1
Me.Caption = s
If sc = 1 Then Exit For
Next
End If
End Sub
按Command1
展开全部
Private Sub Command1_Click()
Timer1.Enabled = False
'可以这样:
unload me
'也可以这样:
end
End Sub
更多追问追答
追问
不是退出程度是停止
追答
你所谓"停止"的概念是什么??
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询