Windows Message Loop in .NET and C#

purplesoup
purplesoup used Ask the Experts™
on
Is it possible to communicate with a .NET application by getting its windows handle and passing a value to it using PostMessage or SendMessage?

Does anyone have an example of the C# code that would handle a PostMessage call?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
Commented:
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasswndproctopic.asp
   
    protected override void WndProc(ref Message m)
    {
        if (m.Msg==WM_XXX) { // trap your msg
            //do something in here...
        }
        base.WndProc(ref m);
    }

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial