Ok thanks to venna I now have a timer working on my login form which when I go to another form the counter still ticks over.
Now I've been working on a way of detecting when the mouse has been moved so that I can set a value, say to 1 when it is moved and then the timer gets to 60x5 (5 mins) it sets a value to 1 and then if they're both one then log off / unload / close db etc.
Here's what I got:
[CODE=vb]
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim DeltaX As Integer
Dim DeltaY As Integer
Dim StartPos As POINTAPI
Dim logintime As Variant
[/CODE]
On form_load
[CODE=vb]' these should be set when the screen saver is in setup mode
DeltaX = 100 ' adjust this for x sensitivity level
DeltaY = 100 ' adjust this for y sensitivity level
Call GetCursorPos(St artPos)[/CODE]
Then in each frame or tab
[CODE=vb]Private Sub SSTab1_MouseMov e(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim NewPos As POINTAPI
Call GetCursorPos(Ne wPos)
Dim CheckX As Integer
Dim CheckY As Integer
CheckX = Abs(NewPos.X - StartPos.X)
CheckY = Abs(NewPos.Y - StartPos.Y)
If CheckX > DeltaX Or CheckY > DeltaY Then
MouseMove = 1
End If[/CODE]
This is really annoying having to put it in each frame and form etc
Is there a way of just dragging a frame all over your form ... making it see-though and then putting that code in for just that frame?
Now I've been working on a way of detecting when the mouse has been moved so that I can set a value, say to 1 when it is moved and then the timer gets to 60x5 (5 mins) it sets a value to 1 and then if they're both one then log off / unload / close db etc.
Here's what I got:
[CODE=vb]
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim DeltaX As Integer
Dim DeltaY As Integer
Dim StartPos As POINTAPI
Dim logintime As Variant
[/CODE]
On form_load
[CODE=vb]' these should be set when the screen saver is in setup mode
DeltaX = 100 ' adjust this for x sensitivity level
DeltaY = 100 ' adjust this for y sensitivity level
Call GetCursorPos(St artPos)[/CODE]
Then in each frame or tab
[CODE=vb]Private Sub SSTab1_MouseMov e(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim NewPos As POINTAPI
Call GetCursorPos(Ne wPos)
Dim CheckX As Integer
Dim CheckY As Integer
CheckX = Abs(NewPos.X - StartPos.X)
CheckY = Abs(NewPos.Y - StartPos.Y)
If CheckX > DeltaX Or CheckY > DeltaY Then
MouseMove = 1
End If[/CODE]
This is really annoying having to put it in each frame and form etc
Is there a way of just dragging a frame all over your form ... making it see-though and then putting that code in for just that frame?
Comment