Process the messages for ALL the applications  
Author Message
Deza





PostPosted: Visual C# General, Process the messages for ALL the applications Top

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



Visual C#2  
 
 
Peter Ritchie





PostPosted: Visual C# General, Process the messages for ALL the applications Top

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

 
 
cablehead





PostPosted: Visual C# General, Process the messages for ALL the applications Top

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.



 
 
Deza





PostPosted: Visual C# General, Process the messages for ALL the applications Top

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++.


 
 
Peter Ritchie





PostPosted: Visual C# General, Process the messages for ALL the applications Top

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.