|
#1
|
||||
|
||||
|
Sense Mouse Movement
Is there any way that AMS (5 or preferably 4 right now) can sense mouse movement? Similar to the way windows does like for a screensaver (to terminate it)? Got an interesting project in mind that would need to exit upon mouse movement or keypress. Thanks for any tips.
|
|
#2
|
||||
|
||||
|
Keypress isn't that hard to do, I think someone posted something about how to key hook using a .dll a while back. But that being said I bet someone here can figure out the mouse movement thing. It can't be that hard because you see it in lots of very simple apps... Cool idea, if someone can figure this out I would probably use it too...
Corey Milner Creative Director, Indigo Rose Software |
|
#3
|
||||
|
||||
|
I know I can figure out a "cheezy" way of doing it with Flash (onMouseMove), but I was hoping for a "global" movement on the screen. Flash will only do it if you broadcast over a MC/Button, etc. Conversely, you could make the clip transparent I guess, but you would still be at the mercy of the confines of the clip - not the whole computer screen.
Where's Worm when you need him, eh (when you get time )? It's probably some kind of dll function that can sense mouse movement; guessing & of course, hoping.
|
|
#4
|
||||
|
||||
|
Maybe if I provide details on what I would like to accomplish here, it would possibly be worthwhile to look into? Still haven't figured out a way and would like some ideas. Anything would be great from any of you gurus!!
Would like to simply launch an AMS executable that would maybe reside in the system tray and be able to sense inactivity of the mouse/keyboard for a period of time (I can do the time part easy enough) - again similar (actually exactly) like a screensaver scenario. When this inactive time has elapsed, launch an external application. Conversely, when it senses mouse/key press activity, while this external app is running, AMS finds the window and closes it. I can figure out everything for this project except the mouse sensing. This poor sole would be willing to pay for a viable solution, it's that important. Thanks for reading! |
|
#5
|
||||
|
||||
|
Well there may very well be a free solution yet I'm sure but just FYI our programmers can be had for a reasonable price and there's not too much they can't figure out.
![]() If you look at the status bar in AMS 5.0 you can see that it is displaying your mouses co-ordinates in real time (I love the status bar in 5.0 A LOT) which is basically what you want to do but in your apps, i.e. a plug-in which adds mouse functions such as: Mouse.X(); Mouse.Y(); And maybe even: Mouse.Hide(); Mouse.Show(); Mouse.CursorAttach(); Mouse.CursorRemove(); Mouse.OnClick(); Just riffing. That would be cool, plus a plug-in like that would have lots of room for version expansion as you could add more and more complex things over time including right click menu controls, augmented events such as OnDrag/OnDrop, hit testing, etc. Corey Milner Creative Director, Indigo Rose Software |
|
#6
|
||||
|
||||
|
I am still working this issue as this thread slowly but surely tries to disappear. Have I stumped everyone, haha, or does it sound like not such a good idea? As in most of my strange cases, I cannot find a solution to this problem (searched for a couple of days on the Net) and I really thought that 5.0 could be the answer, but I can't see how it could do it either. I did manage to figure out (on XP anyway) that "scrnsave.exe" in the system32 directory will launch an executable (even if you change the extension from exe to scr), and you can even select it in properties to set the delay, but I don't know how reliable this will be, and the executable in question is obviously missing some code to terminate the app on keypress or mousemove, so I'm still stuck.
I can't even find a program or a workaround for launching executables (as a quasi-screensaver) anywhere! They all boast to launch images, swf's and even videos, but just a mere program - I guess there's been no demand for this. I may have to live with "press any key" to terminate, but this seems to be a challenge as well. I've seen a couple examples on how to detect individual keys, but would there happen to be a blanket any key script? Or would I have to compile a large script to account for every key? Sorry to ramble. |
|
#7
|
||||
|
||||
|
Isn't there a .dll that was used to set the visibility of the mouse pointer. Could you use that to sense mouse movement. You could use a timer and maybe get the mouse position and compare it with the last poll. Stir and repeat.
Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) · dwFlags A set of flag bits that specify various aspects of mouse motion and button clicking. The bits in this parameter can be any reasonable combination of the following values: MOUSEEVENTF_ABSOLUTE Specifies that the dx and dy parameters contain normalized absolute coordinates. If not set, those parameters contain relative data: the change in position since the last reported position. This flag can be set, or not set, regardless of what kind of mouse or mouse-like device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section. MOUSEEVENTF_MOVE Specifies that movement occurred. MOUSEEVENTF_LEFTDOWN Specifies that the left button changed to down. MOUSEEVENTF_LEFTUP Specifies that the left button changed to up. MOUSEEVENTF_RIGHTDOWN Specifies that the right button changed to down. MOUSEEVENTF_RIGHTUP Specifies that the right button changed to up. MOUSEEVENTF_MIDDLEDOWN Specifies that the middle button changed to down. MOUSEEVENTF_MIDDLEUP Specifies that the middle button changed to up. MOUSEEVENTF_WHEEL Windows NT only: Specifies that the wheel has been moved, if the mouse has a wheel. The amount of movement is given in dwData The flag bits that specify mouse button status are set to indicate changes in status, not ongoing conditions. For example, if the left mouse button is pressed and held down, MOUSEEVENTF_LEFTDOWN is set when the left button is first pressed, but not for subsequent motions. Similarly, MOUSEEVENTF_LEFTUP is set only when the button is first released. · dx Specifies the mouse’s absolute position along the x-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse’s actual x-coordinate; relative data is given as the number of mickeys moved. A mickey is the amount that a mouse has to move for it to report that it has moved. · dy Specifies the mouse’s absolute position along the y-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse’s actual y-coordinate; relative data is given as the number of mickeys moved. · dwData If dwFlags is MOUSEEVENTF_WHEEL, then dwData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120. If dwFlags is not MOUSEEVENTF_WHEEL, then dwData should be zero. · dwExtraInfo Specifies an additional 32-bit value associated with the mouse event. An application calls GetMessageExtraInfo to obtain this extra information. Last edited by TJ_Tigger; 11-12-2003 at 03:34 PM. |
|
#8
|
||||
|
||||
|
Where it be (dll)?? Sounds as if that would be a good start! I'm desperate for any pointers right now (no pun intended).
That's actually how Flash does it, but the [window] needs focus to work. I mean, not even focus because it (cursor) has to actually be inside the movie (let's say - not a 1x1 pixel). I'd like this to work in a basic windows environment if at all possible. OK tigger, that's not fair, you edited while I was typing
|
|
#9
|
||||
|
||||
|
Um...Tigger, can you explain yer last post just a bit? I don't know where to start.
|
|
#10
|
||||
|
||||
|
#11
|
||||
|
||||
|
Quote:
Again, I think you could put this on a timer and have it fire every 60 seconds if you wanted to see if there was mouse movement. |
|
#12
|
||||
|
||||
|
I sorta get the gist, but still don't know where to start :confused:
Where in the heck is Worm!? Haven't seen him around the boards lately. I will play with this tomorrow and see if I can make it do something. It definitely sounds like the right track. Thanks again!
|
|
#13
|
||||
|
||||
|
I'm probably wrong but I think MOUSEEVENTF_MOVE is used to create mouse movement, not detect it... BTW one super easy way if you are in a rush is to use this and serve your content via kiosk mode browser. http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=1274 A cheap workaround I know but it's fast. I'll take a look around and see if I can find any better ideas...
FYI I think getting GetCursorPos from user32.dll is the thing. You can set it on a one second timer to look for any change in that value... Corey Milner Creative Director, Indigo Rose Software |
|
#14
|
|||
|
|||
|
Corey's right, the best bet would be to use GetCursorPos in a timer (use a silent MP3 in 4). Problem is that its not directly callable from AMS because of the way the data is returned. I'll see if I can throw together a wrapper DLL to return the data in a meaningful way. When I do, don't forget to use some sort of tolerance in checking the position. The slightest mouse movement will change the X,Y position.
|
|
#15
|
||||
|
||||
|
This is the 5.0 forum so page timers are available. The moribundly silent MP3 rides no more.
Corey Milner Creative Director, Indigo Rose Software |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
All times are GMT -6. The time now is 03:15 PM.








)? It's probably some kind of dll function that can sense mouse movement; guessing & of course, hoping.
Haven't seen him around the boards lately. I will play with this tomorrow and see if I can make it do something. It definitely sounds like the right track. Thanks again!
Linear Mode
