Search code examples
c#hookdll-injection

Hook and main program communication


There are a lot of articles with information how write hooks to add some specific functionality to other programs or change program behavior. But I not understand what should I do to send data from hook to my program.

My English not so good so I write small example: There are my application(myApp) and not my application(notMyApp). I want to get to the myApp text from chat window from notMyApp. I can write hook for notMyApp using MHOOK for example. The question is how tom send chat text from hook to myApp?

Should I use pipes or something other things?

P.S. I prefer to use C#


Solution

  • There are several methods of interprocess communication.

    1. Pipes (my choice)
    2. Shared memory / File mapping (you can map same region of "page file" to both processes)
    3. Windows message WM_COPYDATA (slow, but easiest)

    and so on... read msdn article for more information