er453r Posted April 24, 2007 Posted April 24, 2007 Hi. How can I detect the direction, of mouse movement "outside" the screen? I mean, that when mouse is at the border (or in the corner) of the screen, cords from MouseGetPos() don't change, but you can still move your mouse physically. Like playing FPS games, when you can do quick turns by sliding the mouse a few times... Eehh... It's hard to explain, but hopefully someone will understand ;P
evilertoaster Posted April 24, 2007 Posted April 24, 2007 im im understadnign you that is entirely dependent on how the game interupits it. For example what if you have your axis inverted? when you scroll the mouse up it in fact slides your viewer down... There wouldnt be much to detect in this case...it all how the game woudl render it...
er453r Posted April 24, 2007 Author Posted April 24, 2007 This isn't a problem. I just can't detect mouse movement when the mouse is for example in the bottom right corner. You can slide it down and right, but you can't detect "mouse sliding" just thought coordinates...
evilertoaster Posted April 24, 2007 Posted April 24, 2007 but you can't detect "mouse sliding" just thought coordinates...err... why not?
er453r Posted April 24, 2007 Author Posted April 24, 2007 Lets continue the "bottom right corner" example. Lets say our screen is 800x600. Mouse pointer is at 800x600. We slide the mouse to the right, but coordinates don't change. We slide the mouse down, but coordinates don't change. So we can't detect the slide thought the coordinates.
evilertoaster Posted April 24, 2007 Posted April 24, 2007 ah, i see you want more of a MouseHook type thing... ehh i think there's some for autoit around...if not try a goole serach for "Mouse hook" or somthing... trouble is trying to get one that hooks movement as most of them want to hook a click event or somthing...but there are some out-and-about if you look around
Gabburd Posted April 25, 2007 Posted April 25, 2007 (edited) A quick and somewhat messy workaround would be to move the mouse to a position and then check how far from that position it has moved. Something like this: CODEHotKeySet( "{ESC}", "OnAutoItExit" ) $x = @DesktopWidth/2 $y = @DesktopHeight/2 GUICreate("MouseRelative", 400, 300) GUISetState() DllCall("User32.dll","long","ShowCursor","short",False) MouseMove ( $x, $y, 0) While 1 $pos = MouseGetPos() $dx = $pos[0]-$x $dy = $pos[1]-$y ConsoleWrite( $dx & ":" & $dy & @CRLF ) MouseMove ( $x, $y, 0) Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd Func OnAutoItExit() Exit EndFuncoÝ÷ Û÷(uæèÄêâ*.v÷öÜÖ°whÀmç(²Ú[z)ài¹^¶buëax+«²Ø¢ç(ºWm¯+aÇ(uæèÅ«¢+Ù!½Ñ-åMÐ ÅÕ½ÐííM ôÅÕ½Ðì°ÅÕ½Ðí=¹Õѽ%Ñá¥ÐÅÕ½Ðì¤)±½°ÀÌØíá}µ½ÕÍ¡½±ôÍѽÁ]¥Ñ ¼È)±½°ÀÌØíå}µ½ÕÍ¡½±ôÍѽÁ!¥¡Ð¼È)5½ÕÍ5½Ù ÀÌØíá}µ½ÕÍ¡½±°ÀÌØíå}µ½ÕÍ¡½±°À¤)]¡¥±Ä($ÀÌØí5½ÕÍ ¡¹ôÑ5½ÕÍ ½½É ¤(% ½¹Í½±]É¥Ñ ÀÌØí5½ÕÍ ¡¹lÁtµÀìÅÕ½ÐìèÅÕ½ÐìµÀìÀÌØí5½ÕÍ ¡¹lÅtµÀì I1¤(%M±À ÈÀ¤)]¹)Õ¹Ñ5½ÕÍ ½½É ¤(%1½°ÀÌØílÉt($ÀÌØíÁ½Ìô5½ÕÍÑA½Ì ¤($ÀÌØílÁtôÀÌØíÁ½ÍlÁt´ÀÌØíá}µ½ÕÍ¡½±($ÀÌØílÅtôÀÌØíÁ½ÍlÅt´ÀÌØíå}µ½ÕÍ¡½±(%5½ÕÍ5½Ù ÀÌØíá}µ½ÕÍ¡½±°ÀÌØíå}µ½ÕÍ¡½±°À¤(%IÑÕɸÀÌØí)¹Õ¹)Õ¹=¹Õѽ%Ñá¥Ð ¤(%á¥Ð)¹Õ¹ Either way is quite messy and I'm sure there's a better way out there. Edited April 25, 2007 by Gabburd
er453r Posted April 25, 2007 Author Posted April 25, 2007 Wow. I've just red your answer. Thank you very much. Unfortunately I solved this problem earlier. But the most interesting thing is that I solved it exactly the same way
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