网页功能: 加入收藏 设为首页 网站搜索  
高进度计时,精确到0.001秒,且不受任何干扰
发表日期:2003-07-02作者:shawls[] 出处:  

'在project中加入一个module,然后在其中加入以下代码:

option explicit

type large_integer

  lowpart as long

  highpart as long

end type

public declare function queryperformancecounter lib "kernel32" _

    (lpperformancecount as large_integer) as long

public declare function queryperformancefrequency lib "kernel32" _

    (lpfrequency as large_integer) as long

public declare function timesetevent lib "winmm.dll" (byval udelay as long, byval _

    uresolution as long, byval lpfunction as long, byval dwuser as long, _

    byval uflags as long) as long

public declare function timekillevent lib "winmm.dll" (byval uid as long) as long

public declare function gettickcount lib "kernel32" () as long

public lmsfreq as long

public timercount as single

public lmmcount as single

public ltimeid as long

public acttime1 as long

public acttime2 as long

public icountstart as single

dim icount as single

'注释: timesetevent的回调函数

sub timeproc(byval uid as long, byval umsg as long, byval dwuser as long, _

  byval dw1 as long, byval dw2 as long)

  

  form1.text2.text = format$(lmmcount, "00.00")

  lmmcount = lmmcount - 0.01

  if lmmcount <= 0 then

    icountstart = 60

    lmmcount = 60

    timercount = 60

    endcount

  end if

end sub

sub endcount()

  icount = icountstart

  icountstart = 0

  timekillevent ltimeid

  acttime2 = gettickcount - acttime1

  with form1

    .command1.enabled = true

    .command2.enabled = false

    .timer1.enabled = false

    

    .text1 = "计数器记时" + format$((60 - icount), "00.00") + " " _

        + "实际经过时间" + format$((acttime2 / 1000), "00.00")

    .text2 = "计数器记时" + format$((60 - lmmcount), "00.00") + " " _

        + "实际经过时间" + format$((acttime2 / 1000), "00.00")

    .text3 = "计数器记时" + format$((60 - timercount), "00.00") + " " _

        + "实际经过时间" + format$((acttime2 / 1000), "00.00")

  end with

end sub

我来说两句】 【加入收藏】 【返加顶部】 【打印本页】 【关闭窗口
中搜索 高进度计时,精确到0.001秒,且不受任何干扰
本类热点文章
  在VB中使用WMI获取系统硬件和软件有关信..
  在VB中使用WMI获取系统硬件和软件有关信..
  将繁体中文字转化成简体中文
  将繁体中文字转化成简体中文
  获取CPU的ID
  获取CPU的ID
  在vb程序中如何获取剪贴板中所复制的文..
  在vb程序中如何获取剪贴板中所复制的文..
  VB编程破解Windows屏幕保护密码
  更新桌面图片
  更新桌面图片
  让程序的鼠标支持滚轮
最新分类信息我要发布 
最新招聘信息

关于我们 / 合作推广 / 给我留言 / 版权举报 / 意见建议 / 广告投放  
Copyright ©2003-2024 Lihuasoft.net webmaster(at)lihuasoft.net
网站编程QQ群   京ICP备05001064号 页面生成时间:0.00387