poisonkiller Posted September 30, 2005 Posted September 30, 2005 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. :">
GaryFrost Posted September 30, 2005 Posted September 30, 2005 (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 September 30, 2005 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now