Jump to content

Stop user from moving a window


Recommended Posts

I want to stop a user from holding down the left mouse button for too long. Or Just disable the left click until they physically release it then enable it again. I was trying to use _ispressed and then block input but then there is no way for me to see if they aren't pressing the button anymore so I can't re-enable it (plus block input seems pretty invasive for what I want).

Any ideas general ideas on how to accomplish this? I don't need code just a few ideas. Clearly the one idea I have with block input doesn't work.

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

I want to stop a user from holding down the left mouse button for too long. Or Just disable the left click until they physically release it then enable it again. I was trying to use _ispressed and then block input but then there is no way for me to see if they aren't pressing the button anymore so I can't re-enable it (plus block input seems pretty invasive for what I want).

Any ideas general ideas on how to accomplish this? I don't need code just a few ideas. Clearly the one idea I have with block input doesn't work.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$testgui = GUICreate("Lock Window", 300, 200, -1, -1, $ws_sysmenu, $ws_ex_toolwindow + $ws_ex_topmost)
$state = GUICtrlCreateLabel("window can be moved", 80, 70, 200, 25)
GUISetOnEvent($gui_event_close, "Terminate")
GUISetState()
GUIRegisterMsg($wm_nchittest, "WM_NCHITTEST")
While 1
   Sleep(10)
WEnd
Func Terminate()
   Exit 0
EndFunc   ;==>Terminate
Func WM_NCHITTEST($hwnd, $imsg, $iwparam, $ilparam)
   If $hwnd = $testgui Then
      Local $aresult = DllCall("User32.dll", "int", "DefWindowProc", "hwnd", $hwnd, "int", $imsg, "int", $iwparam, "int", $ilparam)
      If $aresult[0] = 2 Then
         Return 0
      Else
         Return $aresult[0]
      EndIf
   EndIf
EndFunc   ;==>WM_NCHITTEST

try this code

Link to comment
Share on other sites

 Thanks, psandu.ro. But this is not quite what I'm looking for. I want to do this with any existing window not with a created gui. 

I've also experimented with MouseSetOnEvent_udf. Still looking. If I get any code that I think is close at all I'll post it.

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...