1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Private Declare Function OpenClipboard& Lib "user32" ( _
ByVal hwnd As Long)
Private Declare Function EmptyClipboard& Lib "user32" ()
Private Declare Function CloseClipboard& Lib "user32" ()
Private Declare Function GetActiveWindow& Lib "user32" ()
Private Declare Function SetTimer& Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Private Declare Function KillTimer& Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long)
Public OnTimer&
Private Sub ClearClipBoardWinProc()
If GetActiveWindow <> Application.hwnd Then
OpenClipboard 0
EmptyClipboard
CloseClipboard
End If
End Sub
Public Sub RunTimer(Delai&)
If OnTimer& > 0 Then OffTimer
OnTimer& = SetTimer(0, 0, ByVal Delai&, AddressOf ClearClipBoardWinProc)
End Sub
Public Sub OffTimer(Optional dummy As Byte)
If OnTimer& > 0 Then
OnTimer& = KillTimer(0&, OnTimer&)
OnTimer& = 0
End If
End Sub |
Partager