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运行程序时。过程我想停止。
展开
 我来答
xyc5932
2013-07-12 · TA获得超过231个赞
知道小有建树答主
回答量:775
采纳率:0%
帮助的人:510万
展开全部
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
zmspu1
2013-07-12 · TA获得超过289个赞
知道小有建树答主
回答量:1425
采纳率:100%
帮助的人:1016万
展开全部
Private Sub Command1_Click()
Timer1.Enabled = False
'可以这样:
unload me
'也可以这样:
end
End Sub
更多追问追答
追问
不是退出程度是停止
追答
你所谓"停止"的概念是什么??
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
ok_luo
2013-07-12 · TA获得超过5万个赞
知道大有可为答主
回答量:9310
采纳率:86%
帮助的人:2216万
展开全部
你的问题不怎么清晰?是不是用unload啊!求答案
追问
不好意思。如果我用'Ctrl+1运行程序时。过程我想停止。是怎么做到了
追答

按屏幕上方工具栏的那个停止钮就可以了。

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式