rotclock.cls

来自「VB圣经」· CLS 代码 · 共 54 行

CLS
54
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Clock"
Attribute VB_GlobalNameSpace = True
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'***************************************************************
' (c) Copyright 2000 Matthew J. Curland
'
' This file is from the CD-ROM accompanying the book:
' Advanced Visual Basic 6: Power Techniques for Everyday Programs
'   Author: Matthew Curland
'   Published by: Addison-Wesley, July 2000
'   ISBN: 0-201-70712-8
'   http://www.PowerVB.com
'***************************************************************
Option Explicit

Event Tick(ByVal Current As Date)
Private m_TimerID As Long
Private m_ROTHook As ROTHook
Private Sub Class_Initialize()
    InitROTHook m_ROTHook
    m_ROTHook.Hook.ExposeObject Me, "TimeServer.Clock"
    m_TimerID = SetTimer(0, 0, 1000, AddressOf TimerProc)
    If m_TimerID Then
        g_Clocks.Add ObjPtr(Me), CStr(m_TimerID)
    End If
End Sub
Private Sub Class_Terminate()
    If m_TimerID Then
        KillTimer 0, m_TimerID
        g_Clocks.Remove CStr(m_TimerID)
    End If
    m_ROTHook.Hook.HideObject
End Sub
Public Property Get TimerID() As Long
    TimerID = m_TimerID
End Property
Friend Property Let Locked(ByVal RHS As Boolean)
    m_ROTHook.Hook.Locked = RHS
End Property
Friend Sub Tick()
    RaiseEvent Tick(Now)
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?