-2

To be more specific, i want to write a message in a window process, a game ... just force to send ("hello wolrd") and force an "enter input" ... Is there possible?

Ok, i'm making one BOT for a game, i already got the memory address of some variables as mana, hp and more, now i want something like that... if (mana < x) then says "spells"

Can i use the Process to make it?

Process.GetProcessesByName("process")[0]

Now i'm sending the message from my game using de DLL

 [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern string SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);

but when i try to to send an "ENTER" command like that

SendKeys("{ENTER}", tela);

it just writes {ENTER} but don't use the enter button ... Some one can help?

  • You are not being very clear. Please try to explain better and show some example – NicoRiff Feb 17 '17 at 14:40
  • 1
    [Welcome to Stack Overflow](http://stackoverflow.com/tour). Please explain what you tried...add some code, show examples and explain the problem. This is not a code request forum. Check this [link](http://stackoverflow.com/help/mcve) for learn how you can improve your question. – Mauricio Arias Olave Feb 17 '17 at 14:41
  • try to use delegates and events – Zinov Feb 17 '17 at 14:41
  • @Zinov _"delegates and events"_ - how does one do that for IPC? –  Feb 17 '17 at 14:45
  • Have your first app window move across the screen until it bumps into the other application's window and then display a message _"Hey you! Move out of the way!"_ –  Feb 17 '17 at 14:46
  • There are so many options here...research, try a couple, and then come back with specific questions for us. – Spivonious Feb 17 '17 at 14:57
  • Ok, i'm making one BOT for a game, i already got the memory address of some variables as mana, hp and more, now i want something like that... if (mana < x) then says "spells" – Herbert Junior Feb 17 '17 at 17:09

1 Answers1

0

You can only do what you're asking, with a reasonable amount of effort, if the target program actually has a means of accepting the communication. An example of this would be a standard Web API project wherein sockets are exposed for incoming HTTP communication. If the target program does not have a designated communication protocol then you're going to have to do something hacky.

James B. Nall
  • 1,398
  • 3
  • 16
  • 27