明白你意思了,用sleep函数不行吗?
对不起,我在我自己的程序当中重来没有用过Sleep函数,所以不知道用Sleep或者类似的API是否可以满足你的需求。以前我也有过类似的需求,当时我是自己写了延时函数,我始终记不起为什么我不用Sleep函数。自己写的延时函数现在手头没有,原型大致如下:
dim blnTimerOn as Boolean '全局的变量
Private Sub Sleep2(byval SleepTime as long)
blntimeron=false
tmrSleep.inteval=sleeptime '设置延时时间,当然如果需要的延时有可能超过60秒的话,你可以采用每秒中激活一次timer,然后在去累加计算
tmrsleep.enabl......
for i=0 to 1 step 0
doevents
if blntimeron then exit for '到时候了就退出。
next i
end sub
嗯~~~也许我没有完全搞清楚你的需求,但我的理解是你完全可以利用Timer,然后把客户端返回消息放在Timer里发送啊,比如:
function identifyData()
if dataIsOk() then
tmrSend.interval=10000
tmrSend.enabled=true
end if
end function
sub tmrSend_timer()
tmrSend.enabled=false '一定要在第一句,防止Timer事件重入。
sendOK()
end sub