Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Detect Event

Detect Event

Scheduled Pinned Locked Moved C#
questionhelptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dataminers
    wrote on last edited by
    #1

    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...

    P D 2 Replies Last reply
    0
    • D dataminers

      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...

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      One would need to tell the other.

      1 Reply Last reply
      0
      • D dataminers

        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...

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        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...

        P 1 Reply Last reply
        0
        • D Dave Kreskowiak

          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...

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Yeah, that's what I said. :-D

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups