有没有关于象屏幕保护一样的代码?
就是我在计算机某个时间内没有动过,就会出现象屏幕保护一样效果的代码
我最主要的还是想知道如何判断计算机没有操作!
[解决办法]
取得系置
Type PointApi
X As Long
Y As Long
End Type
Declare Function GetCursorPos Lib "user32 " (lpPoint As PointApi) As Long
Declare Function GetKeyboardState Lib "user32 " (pbKeyState As Byte) As Long
Declare Function GetForegroundWindow Lib "user32 " () As Long
Private Up_Time, Old_Point As PointApi
Function FreeTime() As Long
If GetForegroundWindow = Application.hWndAccessApp Then
'判Mouse是否在使用
Dim New_Point As PointApi
GetCursorPos New_Point
If Old_Point.X <> New_Point.X Or Old_Point.Y <> New_Point.Y Then
Up_Time = Time
Old_Point = New_Point
Exit Function
End If
'判是否在使用
Dim KeyStat(0 To 255) As Byte
Call GetKeyboardState(KeyStat(0))
For I = 0 To 255
If (KeyStat(I) And &H80) = &H80 Then
Up_Time = Time
Exit Function
End If
Next
End If
Ext:
FreeTime = DateDiff( "s ", Up_Time, Time)
End Function
Private Sub UserControl_Initialize()
Up_Time = Time
End Sub