关于当前时间显示的问题?怎么才能将当前时间毫秒部分也显示出来。

解决方案 »

  1.   

    用timer可以做,但不准确,不知道有没有相关的api,期待答案
      

  2.   

    Option ExplicitPrivate Sub Command1_Click()
    MsgBox Now
    End Sub显示毫秒可以用TIMER控件来实现
      

  3.   

    Private Type SYSTEMTIME
            wYear As Integer
            wMonth As Integer
            wDayOfWeek As Integer
            wDay As Integer
            wHour As Integer
            wMinute As Integer
            wSecond As Integer
            wMilliseconds As Integer
    End Type
    Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)Private Sub Form_Load()
        Dim m As SYSTEMTIME
        
        GetLocalTime m
        
        MsgBox m.wHour & ":" & m.wMinute & ":" & m.wSecond & ":" & m.wMilliseconds
        
    End Sub
      

  4.   

    这个bas的sysTime精度很高,你可以用
    '简易计时器
    '逍遥浪子编程
    '网志:http://blog.csdn.net/xiaoyaolz/
    Option Explicit
    Public Const WM_TIMER = &H113
    Dim timerid As Long
    Dim TimerHwnd As Long
    Public timeropened As BooleanPrivate Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
    Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
    Private Function TimerProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal Idevent As Long, ByVal sysTime As Long) As Long
    'On Error GoTo eRR
        If Msg = WM_TIMER Then
        '***
        Call apitimercallback
        End If
        TimerProc = 1
        Exit Function
    eRR:
    End Function
    Function opentimer(bypausetime, Optional byhwnd As Long, Optional bytimerid As Integer = 1)
    On Error GoTo eRR
    TimerHwnd = byhwnd
    timeropened = True
    timerid = SetTimer(byhwnd, 1, bypausetime, AddressOf TimerProc)
    Exit Function
    eRR:
    End Function
    Function closetimer()
    KillTimer TimerHwnd, timerid
    timeropened = False
    End Function
    'Function apitimercallback()
    'MsgBox "设置处理命令到此"
    'End Function