Skrip Posted May 4, 2007 Share Posted May 4, 2007 (edited) How do you set an area for the mouse to not be allowed to go in?Like over a certain part of a window. How do you do that?Kinda like the opposite of _MouseTrap() Edited May 4, 2007 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
BrettF Posted May 4, 2007 Share Posted May 4, 2007 How do you set an area for the mouse to not be allowed to go in?Like over a certain part of a window. How do you do that?Maybe Modify _MouseTrap?????? Im not sure....... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Skrip Posted May 4, 2007 Author Share Posted May 4, 2007 I thought of that. But I have no idea how the DLL works. I just tried messing with it, and it is not working so well. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
BrettF Posted May 4, 2007 Share Posted May 4, 2007 I thought of that. But I have no idea how the DLL works. I just tried messing with it, and it is not working so well.Hmmm....... Neither do I.... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
The Kandie Man Posted May 5, 2007 Share Posted May 5, 2007 (edited) Nope, you can't do it with the dll unless there is a specific function in the WINAPI that does it. In the case of _MouseTrap(), there is just that, a specific WINAPI function that traps a mouse in a certain location. I don't know of a function that prevents a cursor from going to a certain location, but I made a function myself that repels a cursor. The function must be called constantly as only prevents the cursor from going into the specific area when it is run. expandcollapse popupGlobal $GUI = GUICreate("Can't Touch This",200,100,200,200) GUISetState() AdlibEnable("CallMouseRepel",10) While 1 sleep(1000) WEnd Func CallMouseRepel() $coords = WinGetPos($GUI) _MouseRepel($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3]) EndFunc ;=============================================================================== ; ; Description: _MouseRepel ; Parameter(s): $i_left - Left coord ; $i_top - Top coord ; $i_right - Right coord ; $i_bottom - Bottom coord ; User CallTip: _MouseRepel([$i_left = 0[, $i_top = 0[, $i_right = 0[, $i_bottom = 0]]]]) Repel the Mouse Cursor to specified coords. ; Author(s): The Kandie Man ; Note(s): This function must be called constantly to prevent the mouse cursor from entering the area. ; It is therefore recommended that you call this function from another function that is called by AdlibEnable every 1 to 50ms. ; ;=============================================================================== Func _MouseRepel($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0) Local $a_MousePos = MouseGetPos() Local $i_XCordinate = -1, $i_YCordinate = -1 If $a_MousePos[0] >= $i_left And $a_MousePos[0] <= $i_right Then If ($a_MousePos[0] - $i_left) < ($i_right - $a_MousePos[0]) Then $i_XCordinate = $i_left - 1 Else $i_XCordinate = $i_right + 1 EndIf EndIf If $a_MousePos[1] >= $i_top And $a_MousePos[1] <= $i_bottom Then If ($a_MousePos[1] - $i_top) < ($i_bottom - $a_MousePos[1]) Then $i_YCordinate = $i_top - 1 Else $i_YCordinate = $i_bottom + 1 EndIf EndIf If $i_XCordinate <> -1 And $i_YCordinate <> -1 Then If Abs($i_XCordinate - $a_MousePos[0]) > Abs($i_YCordinate - $a_MousePos[1]) Then MouseMove($a_MousePos[0],$i_YCordinate,1) Elseif Abs($i_XCordinate - $a_MousePos[0]) < Abs($i_YCordinate - $a_MousePos[1]) Then MouseMove($i_XCordinate,$a_MousePos[1],1) Else MouseMove($i_XCordinate,$i_YCordinate,1) EndIf EndIf EndFunc I hope this is what you are looking for. - The Kandie Man ;-) EDIT: Fixed a minor error and cleaned up the code. Edited May 5, 2007 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
Skrip Posted May 5, 2007 Author Share Posted May 5, 2007 Thank you! It will work great! The only thing I can think of that would be better, is the opposite of the mouse trap. But this will work great. Thanks. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
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