不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
VB6.0调用SetTimer实现定时器
编辑:dnawo 日期:2010-10-12
Timer.bas:
窗体代码:
说明
TimerProc函数定义一定要放在bas模块文件中,否则运行代码"lngTimerID = SetTimer(0, 0, 5000, AddressOf TimerProc)"会报错,提示:操作符 AddressOf 使用无效。
复制内容到剪贴板 程序代码
Option Explicit
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
MsgBox Now()
End Sub
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
MsgBox Now()
End Sub
窗体代码:
复制内容到剪贴板 程序代码
Option Explicit
Dim lngTimerID As Long
Dim BlnTimer As Boolean
Private Sub Form_Load()
BlnTimer = False
Command1.Caption = "定时开始"
End Sub
Private Sub Form_Unload(Cancel As Integer)
KillTimer 0, lngTimerID
End Sub
Private Sub Command1_Click()
If BlnTimer = False Then
'每5秒钟调用一次函数
lngTimerID = SetTimer(0, 0, 5000, AddressOf TimerProc)
BlnTimer = True
Command1.Caption = "定时结束"
Else
KillTimer 0, lngTimerID
BlnTimer = False
Command1.Caption = "定时开始"
End If
End Sub
Dim lngTimerID As Long
Dim BlnTimer As Boolean
Private Sub Form_Load()
BlnTimer = False
Command1.Caption = "定时开始"
End Sub
Private Sub Form_Unload(Cancel As Integer)
KillTimer 0, lngTimerID
End Sub
Private Sub Command1_Click()
If BlnTimer = False Then
'每5秒钟调用一次函数
lngTimerID = SetTimer(0, 0, 5000, AddressOf TimerProc)
BlnTimer = True
Command1.Caption = "定时结束"
Else
KillTimer 0, lngTimerID
BlnTimer = False
Command1.Caption = "定时开始"
End If
End Sub
说明
TimerProc函数定义一定要放在bas模块文件中,否则运行代码"lngTimerID = SetTimer(0, 0, 5000, AddressOf TimerProc)"会报错,提示:操作符 AddressOf 使用无效。
上一篇: 安装Microsoft .NET Framework 4.0后站点所有ASPX页面404解决方法
下一篇: Fireworks 8三步制作图片撕裂效果
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
下一篇: Fireworks 8三步制作图片撕裂效果
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
评论: 0 | 引用: 0 | 查看次数: 7076
发表评论
请登录后再发表评论!