views:

138

answers:

1

Hi Folks,

Hoepfully someone can shed some light on a problem - I am trying to listen to\intercept all windows messages generated by an application and dispose of certain types, for example Notify or Gesture messages.

I have been reading articals on how to do this using the Microsoft.WindowsCE.Forms.MessageWindow and creating a class which inherits this, overrides the WndProc method but I have been unalbe to get this start listening\watching the message queue automatically when the application starts.

I know it is possible to do this with the OpenNetCF framework and the Application2 namespace however I would prefer not to use 3rd party software at the moment - no offence to the OpenNetCF guys.

Hopefully this makes sense. Also, i am using C#2.0 and Windows Mobile 6.5.

Thanks for your help,

Morris

+1  A: 

The solution, then, is pretty simple - all you have to do is spend your time duplicating what the Smart Device Framework code is doing.

You need to create your own message pump via P/Invokes to GetMessage, TranslateMessage and DispatchMessage (it will look just like it does in C). Use this pump instead of calling Application.Run (so there can be no calls to Application.Run in your application).

Inside that new message pump insert your filtering logic.

ctacke
OpenNETCF lets you create custom filters as well, right? Man you already got a whole bunch of really sweet tech there. Am I right in understanding that the professional license gives you access to the source too?
Quibblesome
100% correct, the paid version includes the full source.
ctacke
Thanks for the help - decided to do the sensible thing and use the OpenNetCF.Thanks again!
Morrislgn

related questions