Jump to content

Recommended Posts

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. :">

Link to post
Share on other sites

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.

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...