游戏开发论坛

 找回密码
 立即注册
搜索
12
返回列表 发新帖
楼主: Miu.C

(转)统计VB程序的运行时间

[复制链接]

1

主题

102

帖子

108

积分

注册会员

Rank: 2

积分
108
QQ
发表于 2006-11-12 00:33:00 | 显示全部楼层

Re:(转)统计VB程序的运行时间

那就多线程,一秒时间+1,线程最高优先权
Public Const MaxValue As ULong = 18446744073709551615
     成员属于: System.ULong
所以能统计上亿年(584942417355.07203243911719939117)

没试
Imports System.Threading

    Public Class Test
        Dim tMainRoutine As Thread
        Dim abc As Uint64 = 0

        Public Sub New()
            tMainRoutine = New Thread(AddressOf AAA)
            tMainRoutine.SetApartmentState(ApartmentState.STA)
            tMainRoutine.Priority = ThreadPriority.Highest

            tMainRoutine.Start()
        End Sub

        Public Sub StopPass()
            tMainRoutine.Abort()
        End Sub

        Public Sub AAA()
            Do
                Thread.Sleep(1000)
                abc +=1
                If Not tMainRoutine.IsAlive Then 有人搞破坏
                If abc>=??? Then ...
            Loop
        End Sub

        ReadOnly Property GetTime() As String
         Get
          Return  Convert.Tostring(abc \86400) & ":" &  Convert.Tostring((abc \3600) mod 24) & ":" & Convert.Tostring((abc \60) mod 60) & ":" & Convert.Tostring(abc mod 60)
         End Get
        End Property
    End Class


187

主题

6490

帖子

6491

积分

论坛元老

团长

Rank: 8Rank: 8

积分
6491
 楼主| 发表于 2006-11-12 12:32:00 | 显示全部楼层

Re: Re:(转)统计VB程序的运行时间

Canbitwell: Re:(转)统计VB程序的运行时间

那就多线程,一秒时间+1,线程最高优先权
Public Const MaxValue As ULong = 18446744073709551615
     ...

你.Net啊???

0

主题

1

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2006-11-13 18:33:00 | 显示全部楼层

Re: (转)统计VB程序的运行时间

用TIMER很容易被变速齿轮等其它软件停止时间的,呵

用timer函数吧,或者用API,GetTick
timer 获取从午夜12点至现在的毫秒数

如: msgbox timer

187

主题

6490

帖子

6491

积分

论坛元老

团长

Rank: 8Rank: 8

积分
6491
 楼主| 发表于 2006-11-13 18:39:00 | 显示全部楼层

Re:(转)统计VB程序的运行时间

我记得变速齿轮能变CS的速度,难道CS也是用Timer的吗??

270

主题

6442

帖子

6446

积分

论坛元老

Rank: 8Rank: 8

积分
6446
发表于 2006-11-14 12:39:00 | 显示全部楼层

Re:(转)统计VB程序的运行时间

TIMER有他存在的意义就不会被MS取消,要是没意义在VB4后就取消了。

0

主题

3

帖子

9

积分

新手上路

Rank: 1

积分
9
发表于 2006-11-14 14:43:00 | 显示全部楼层

Re:(转)统计VB程序的运行时间

用datediff函数.....

34

主题

443

帖子

478

积分

中级会员

Rank: 3Rank: 3

积分
478
发表于 2006-11-16 18:23:00 | 显示全部楼层

Re:(转)统计VB程序的运行时间

用GetTimeTick+循环应该也行

1

主题

9

帖子

15

积分

新手上路

Rank: 1

积分
15
发表于 2006-12-9 12:40:00 | 显示全部楼层

Re:(转)统计VB程序的运行时间

firstTime=Now()
结束时再
LastTime=now()
然后再
dateAdd()
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-26 00:49

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表