home *** CD-ROM | disk | FTP | other *** search
-
- Private Sub tmrChkStatus_Timer()
-
- ' This event will fire about 4 times per second,
- ' and is used to see if the control's status
- ' changes from selected ("lighted") to
- ' un-selected, and vice-versa.
-
- Dim lonCStat As Long
- Dim lonCurrhWnd As Long
-
- ' Disable the timer temporarily.
- tmrChkStatus.Enabled = False
-
- ' Using two Windows API functions, determine the
- ' handle of the window that the cursor is
- ' currently positioned on.
- lonCStat = GetCursorPos&(mpoiCursorPos)
- lonCurrhWnd = WindowFromPoint(mpoiCursorPos.X, _
- mpoiCursorPos.Y)
-
- If mbooButtonLighted = False Then
- ' If the control is not currently "lighted",
- ' and it matches the handle of the window that
- ' the cursor is on, either light it up (if
- ' ButtonMode = Text Only Mode) or switch its
- ' background image to the one that indicates
- ' that the button is selected.
- If lonCurrhWnd = UserControl.hWnd Then
- mbooButtonLighted = True
- If mmodButtonMode = [Text Only Mode] Then
- UserControl.BackColor = molcSelColor
- Else
- Set UserControl.Picture = mpicSelPicture
- End If
- End If
- Else
- ' If the control is "lit", and it no longer
- ' matches the handle of the window that the
- ' cursor is on, either un-light it (if
- ' ButtonMode = Text Only Mode) or switch its
- ' background image to the one that indicates
- ' that the button is not selected.
- If lonCurrhWnd <> UserControl.hWnd Then
- mbooButtonLighted = False
- If mmodButtonMode = [Text Only Mode] Then
- UserControl.BackColor = molcBackColor
- Else
- Set UserControl.Picture = mpicPicture
- End If
- End If
- End If
-
- ' Re-enable the timer.
- tmrChkStatus.Enabled = True
-
- End Sub
-