I\'m writing a C# application which needs to intercept Window Messages that another applications is sending out. The company who wrote the application I\'m
I think the problem is with your P/Invoke definition for RegisterWindowMessage(). pinvoke.net suggests using the following:
[DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern uint RegisterWindowMessage(string lpString);
Using uint as the return value instead of IntPtr should make the difference. Typically you want to use IntPtr when the return value is a handle (such as an HWND or HANDLE), but when the return value can be directly converted to a C# type it is better to use that type.