Sign in to follow this  
Followers 0
poisonkiller

MouseGetPos()

3 posts in this topic

I want program, what logoff, when user moves mouse. My code:

#include <GUIConstants.au3>
GUICreate("UserProtecter", 200, 100)
$input = GUICtrlCreateInput("", 10, 10, 50, 20)
$time = GUICtrlCreateUpdown($input)
GUICtrlSetLimit($time, 1000, 0)
$okbut = GUICtrlCreateButton("OK", 10, 40, 40, 20)
$exitbut = GUICtrlCreateButton("Exit", 60, 40, 40, 20)
GUISetState()
Do
    $msg = GUIGetMsg()
Select
Case $msg = $okbut
GUISetState(@SW_HIDE)
$mpos1 = MouseGetPos()
Sleep(GUICtrlRead($input) &"000")
While 1
    If $mpos1 <> $mpos1 Then
        MsgBox(16, "", "Logoff")
        Exit
Else
    Exit    
EndIf
Wend
EndSelect
Until $msg = $GUI_EVENT_CLOSE or $msg = $exitbut

It sends every time message box, when i move mouse or not. Need help!!

And sorry about my bad english. :">

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I think this is what your trying to attempt, or close to it:

CODE

#include <GUIConstants.au3>

GUICreate("UserProtecter", 200, 100)

$input = GUICtrlCreateInput("", 10, 10, 50, 20)

$time = GUICtrlCreateUpdown($input)

GUICtrlSetLimit($time, 1000, 0)

$okbut = GUICtrlCreateButton("OK", 10, 40, 40, 20)

$exitbut = GUICtrlCreateButton("Exit", 60, 40, 40, 20)

GUISetState()

Do

$msg = GUIGetMsg()

Select

Case $msg = $okbut

GUISetState(@SW_HIDE)

$mpos1 = MouseGetPos()

Sleep(GUICtrlRead($input) & "000")

While 1

$mpos2 = MouseGetPos()

If $mpos1[0] <> $mpos2[0] Or $mpos1[1] <> $mpos2[1] Then

MsgBox(16, "", "Logoff")

Exit

EndIf

WEnd

EndSelect

Until $msg = $GUI_EVENT_CLOSE Or $msg = $exitbut

Edit: corrected type-o

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanks, its working!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0