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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. sending message to other process

sending message to other process

Scheduled Pinned Locked Moved IT & Infrastructure
helpgame-devjsontutorialquestion
2 Posts 2 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.
  • N Offline
    N Offline
    N Q H
    wrote on last edited by
    #1

    Hi everybody,:) I am playing a game which used keyboard to control my character. I must combine some keys at one time to have a special kick.For example(A+Space+Enter) So, I decided to write an Application which can support for playing this game.When I call attack() funtion, the character will have a special kick automatically. To solve this problem, I tried to send message to game I used PostMessage API function : public void SendKeyDown(int key) { PostMessage(handle,WM_KEYDOWN,key,IntPtr.Zero); } The trouble is my game was not receive this message(Some games received but some games din't :confused:) I tried other ways, use SendMessage,Keybd_Event but all of them are not work. Could you give me some help? thank you very much!

    mixiaojion

    L 1 Reply Last reply
    0
    • N N Q H

      Hi everybody,:) I am playing a game which used keyboard to control my character. I must combine some keys at one time to have a special kick.For example(A+Space+Enter) So, I decided to write an Application which can support for playing this game.When I call attack() funtion, the character will have a special kick automatically. To solve this problem, I tried to send message to game I used PostMessage API function : public void SendKeyDown(int key) { PostMessage(handle,WM_KEYDOWN,key,IntPtr.Zero); } The trouble is my game was not receive this message(Some games received but some games din't :confused:) I tried other ways, use SendMessage,Keybd_Event but all of them are not work. Could you give me some help? thank you very much!

      mixiaojion

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Each app deals with keyboard input in its own way. It can: - act on KeyDown, KeyPress, KeyUp, or some combination of them; - have only one or a few of its windows (Form, Panel, PictureBox, ...) listen to the keyboard (and possibly use a form preview). Whar you should do is: 1. send ALL the messages that belong to a keyboard action, that would be: - KeyDown on key down, then KeyPress AND KeyUp on key up (for regular keys) - KeyDown and KeyUp for special keys 2. for each target game try to figure which window is actively listening to the keyboard. You may have to provide extra events to correctly notify a key is held down (generating the autorepeat effect). :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


      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