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. button click through another program

button click through another program

Scheduled Pinned Locked Moved C#
sysadminhelpquestion
8 Posts 4 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
    Deresen
    wrote on last edited by
    #1

    Hello everyone, I've got a little problem. In an office, there is a server running with a program and in that program is a button to switch off all the lights. But I would like to have a phisical button. Let's say that we use a keyboard button. The problem is that there is no source code for the serverprogram. So I would like to know if it is possible to make another program, which can get an keyboard-event and let this event click on the button in another program? And a happy new year to all of you!

    C S L 3 Replies Last reply
    0
    • D Deresen

      Hello everyone, I've got a little problem. In an office, there is a server running with a program and in that program is a button to switch off all the lights. But I would like to have a phisical button. Let's say that we use a keyboard button. The problem is that there is no source code for the serverprogram. So I would like to know if it is possible to make another program, which can get an keyboard-event and let this event click on the button in another program? And a happy new year to all of you!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can find the window handle of the button and send it a message. It's fiddly, hacky and ugly, but it will work. The second half, you can write a system wide keyboard hook, or another program which, when it's got the focus, gets the keyboard event, then finds that window and sends it the message.

      Christian Graus Driven to the arms of OSX by Vista.

      1 Reply Last reply
      0
      • D Deresen

        Hello everyone, I've got a little problem. In an office, there is a server running with a program and in that program is a button to switch off all the lights. But I would like to have a phisical button. Let's say that we use a keyboard button. The problem is that there is no source code for the serverprogram. So I would like to know if it is possible to make another program, which can get an keyboard-event and let this event click on the button in another program? And a happy new year to all of you!

        S Offline
        S Offline
        Silvyster
        wrote on last edited by
        #3

        hmmmm, I wanted to do this for a long time, is it possible if I just use the Mouse? a program that will set the position of the mouse on the screen using coordinates and then the mouse CLICKS (without user interaction) using a code.

        D 1 Reply Last reply
        0
        • S Silvyster

          hmmmm, I wanted to do this for a long time, is it possible if I just use the Mouse? a program that will set the position of the mouse on the screen using coordinates and then the mouse CLICKS (without user interaction) using a code.

          D Offline
          D Offline
          Deresen
          wrote on last edited by
          #4

          haha, I like this anwser. Simple and maybe usefull, though it's tricky when the screen changes or is moved. But thanks for this insight.

          1 Reply Last reply
          0
          • D Deresen

            Hello everyone, I've got a little problem. In an office, there is a server running with a program and in that program is a button to switch off all the lights. But I would like to have a phisical button. Let's say that we use a keyboard button. The problem is that there is no source code for the serverprogram. So I would like to know if it is possible to make another program, which can get an keyboard-event and let this event click on the button in another program? And a happy new year to all of you!

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hire a programmer :)

            I are troll :)

            D 1 Reply Last reply
            0
            • L Lost User

              Hire a programmer :)

              I are troll :)

              D Offline
              D Offline
              Deresen
              wrote on last edited by
              #6

              I am the programmer, still learning, but I just needed some solution-idea's to the problem. As I have the idea's, I can try to build the app.

              L 1 Reply Last reply
              0
              • D Deresen

                I am the programmer, still learning, but I just needed some solution-idea's to the problem. As I have the idea's, I can try to build the app.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                It was a rude statement, my apologies. The server-application is running under Windows? In that scenario, FindWindow and SendKeys will do the trick, as other people already mentioned.

                I are troll :)

                D 1 Reply Last reply
                0
                • L Lost User

                  It was a rude statement, my apologies. The server-application is running under Windows? In that scenario, FindWindow and SendKeys will do the trick, as other people already mentioned.

                  I are troll :)

                  D Offline
                  D Offline
                  Deresen
                  wrote on last edited by
                  #8

                  I forgive your stupidity ;P Thank you very much. I guess I'll conquer this problem.

                  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