Process the messages for ALL the applications

In C#

The WndPro method proccess all Windows messages for MY Application, but How can I make a method to process the messages for ALL the applications

Thanks



Answer this question

Process the messages for ALL the applications

  • Horea Soanca

    You would have to write a system-wide hook, which is not recommended in general and has issues when written as a managed component.

  • vijeyan

    It's not a limitation of C#, it's a limitation of .NET. The system-wide hooks require a DLL entry point (a global function, if you will) and don't use COM interfaces. Since .NET doesn't really allow you to do such things it makes implementing a system-wide hook very, very difficult.

    Over-and-above-that, implementing a .NET component that hooks into another process/component that isn't expecting the CLR to be injected is fraught with problems.

  • sugrhigh

    You can't with C# alone. You need a dll for a global hook(s).

    There are a couple of examples on codeproject. Won't be a walk in the park tho.

    The most reliable third party control I've seen for that undertaking is Desaware SpyWorks.



  • PiGuy

    Thanks for your answers.

    I'm just looking for a way to change the cursor when it is over other application (i.e. windows calculator).

    I don't believe that C# can't do something that is possible in C/C++.


  • Process the messages for ALL the applications