Detect Event
-
How can I get event action (especially mouse events) on windows form use another program? For example; User darw rectangle on form use with "Program1". Another program (may be windows service) detect user action in "Program1". Main problem is "Program1" and other program (windows service) in different application domain. How can I get event from another program? Thanks...
-
How can I get event action (especially mouse events) on windows form use another program? For example; User darw rectangle on form use with "Program1". Another program (may be windows service) detect user action in "Program1". Main problem is "Program1" and other program (windows service) in different application domain. How can I get event from another program? Thanks...
One would need to tell the other.
-
How can I get event action (especially mouse events) on windows form use another program? For example; User darw rectangle on form use with "Program1". Another program (may be windows service) detect user action in "Program1". Main problem is "Program1" and other program (windows service) in different application domain. How can I get event from another program? Thanks...
There is no communication between the two processes. Your service code will never know the user did anything in the other application. Hooking the message pump of another application and interpreting what the user sees and is doing with the mouse is VERY complicated and is, depending on your skill level, going to be prone to failures. I know, you asked about events. "Events", in the method that you're probably thinking of using, do not cross process boundries. There is no way for a message pump in one application to raise an event in another app. The application that the user is clicking around in would have to handle it's own, for example, Click event, then setup and make an interprocess call to your service, or, just send the service process a message over some communication line you've setup in both applications. The best option would be, if you wrote both applications, to setup a communication system between the two apps so the application the user is using can tell the service what's going on and what the user is doing. It is always far easier, and more reliable, for an application to tell another one what it is doing than it is for an application to try and figure out what is going on in another application by "watching" it.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
There is no communication between the two processes. Your service code will never know the user did anything in the other application. Hooking the message pump of another application and interpreting what the user sees and is doing with the mouse is VERY complicated and is, depending on your skill level, going to be prone to failures. I know, you asked about events. "Events", in the method that you're probably thinking of using, do not cross process boundries. There is no way for a message pump in one application to raise an event in another app. The application that the user is clicking around in would have to handle it's own, for example, Click event, then setup and make an interprocess call to your service, or, just send the service process a message over some communication line you've setup in both applications. The best option would be, if you wrote both applications, to setup a communication system between the two apps so the application the user is using can tell the service what's going on and what the user is doing. It is always far easier, and more reliable, for an application to tell another one what it is doing than it is for an application to try and figure out what is going on in another application by "watching" it.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...Yeah, that's what I said. :-D