tolong di approve ya, cuma pengen share aja.
===================================================================
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI)
As Long
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey
As Long) As Integer
Private Type POINTAPI
x As Long
y As Long
End Type
----------------------------------------------------------------------------------------------
Private Sub Timer1_Timer()
Static lNotActive As Long
Static LastCursorPos As POINTAPI
Dim CursorPos As POINTAPI
Dim lCounter As Integer
lNotActive = lNotActive + 1
GetCursorPos CursorPos
If (CursorPos.x <> LastCursorPos.x) Or (CursorPos.y <> LastCursorPos.y) Then
'The cursor of the mouse is not the same position as before
LastCursorPos = CursorPos
lNotActive = 0
Else
'The mouse is at the exact same position as 1 second before... check
if any key was pressed.
For lCounter = 0 To 255
If GetAsyncKeyState(lCounter) <> 0 Then
'A key has been pressed.
lNotActive = 0
End If
Next
End If
If lNotActive = 60 Then '60=1 minutes
' An idle-minute.
' what do you want to do here, script here
lNotActive = 0
End If
End Sub
gunartha.nyoman wrote:
>
>
> Haloo semua...
>
> Ada yg bisa bantu agak ya..
> saya mo tanya kira-kira gimana caranya mendeteksi kalau komputer atau
> program yg dibuat dari VB itu idle.
> dan ketika idle sekitar 15 menit maka program exe nya akan otomatis tutup.
>
> Terima kasih sebelumnya
>
> salam dari,
> Gunartha
>
>