Program to execute keyboard commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • odin607
    New Member
    • Jun 2008
    • 19

    Program to execute keyboard commands

    What would code look like for a program that just hit a key over and over in C?

    (basically how would code a program to press a key as if it was manually pressed)
  • jhaxo
    New Member
    • Dec 2007
    • 57

    #2
    If the os is windows i would try PostMessage to send a WM_Key message.

    Comment

    • odin607
      New Member
      • Jun 2008
      • 19

      #3
      whats the code look like for it? im very unfamiliar with it, i looked up the syntax but kinda blew over my head

      Comment

      • jhaxo
        New Member
        • Dec 2007
        • 57

        #4
        Originally posted by odin607
        whats the code look like for it? im very unfamiliar with it, i looked up the syntax but kinda blew over my head
        Is this an mfc program or sdk?

        If its mfc just enter :: and begin typing PostMessage and intellisense should tell you the parameters you need.

        Its been some time since i used this, sorry.

        Comment

        • odin607
          New Member
          • Jun 2008
          • 19

          #5
          i dont know C++, i should have specified C

          however if anyone can give me the C++ code to do it (and any other sort of libraries or whatever else is needed) i wouldnt mind using it at all

          program i use is ms visual studio 2008


          i tried the :: then looked through the options, theres no postmessage.. i assumed cause i didnt load a library (not sure which to load.. since i dont know C++)

          Comment

          • jhaxo
            New Member
            • Dec 2007
            • 57

            #6
            Originally posted by odin607
            i dont know C++, i should have specified C

            however if anyone can give me the C++ code to do it (and any other sort of libraries or whatever else is needed) i wouldnt mind using it at all

            program i use is ms visual studio 2008


            i tried the :: then looked through the options, theres no postmessage.. i assumed cause i didnt load a library (not sure which to load.. since i dont know C++)

            u need to include winuser.h.
            i think the rule of the forum is we arent supposed to give out code unless the poster makes some kind of stab at it themseleves.

            Comment

            Working...