none
What is windows message?

    Question

  • Hi Guys,

    I am working on a report regarding on the windows message topic. I have searched some online resources for it, however I cannot find out the helpful documents. Can anyone help me with this please?
    Basically the report try to represent the following sections:

    • Define what Windows messages are and when they occur.
    • Explain how a message is involved in a Windows event.
    • Explain the role of the form’s message queue.
    • Discuss why C# code would want to use Windows messages.
    • Explain how C# code can respond to Windows messages and how C# code can generate Windows messages.
    • Discuss any other points that a programmer needs to understand in relation to using Windows messages with C#.
    Any hints or articles on this would be helpful.

    Thank you very much.

    Chriz
    • Edited by Royal Oak Monday, September 22, 2008 4:21 AM
    Monday, September 22, 2008 4:20 AM

Answers

  • Windows message are how the os passes messages to applications (mouse move, keyboard input, shutdown, etc).  In C# the Application.Run(Form) starts the message loop.  You can also do a loop with do events, or do manually with unmanaged peekmessage, translatemessage, dispatchmessage.  To hook in to the application message loop you can use Application.AddMessageFilter(IMessageFilter) and create your own message filter.  You can also override the WndProc method of a control or form.  To see a list of all the differnt messages look in windows.h they are all prefixed with WM.  You can also use the Spy++ tool that comes with visual studio to inspect messages from any application.

    Using Messages and Message Queues
    http://msdn.microsoft.com/en-us/library/ms644928(VS.85).aspx
    http://msdn.microsoft.com/en-us/library/ms644927(VS.85).aspx

    http://msdn.microsoft.com/en-us/library/system.windows.forms.imessagefilter.aspx
    http://msdn.microsoft.com/en-us/library/system.windows.forms.application.addmessagefilter.aspx
    • Marked as answer by jack 321 Thursday, September 25, 2008 5:53 AM
    Monday, September 22, 2008 4:32 AM
  • Hi,

    Spy++ is one of the tools that comes with Visual Studio. So if you still haven't seen it, start your Visual Stdio and open Spy++ from Tool menu.


    for more help on Spy++ follow this link 

    http://www.codeproject.com/KB/cpp/Spy__.aspx

    Cheers by Anand Ranjan
    Developer
    • Marked as answer by Royal Oak Monday, October 06, 2008 5:41 AM
    Monday, October 06, 2008 4:58 AM

All replies

  • Windows message are how the os passes messages to applications (mouse move, keyboard input, shutdown, etc).  In C# the Application.Run(Form) starts the message loop.  You can also do a loop with do events, or do manually with unmanaged peekmessage, translatemessage, dispatchmessage.  To hook in to the application message loop you can use Application.AddMessageFilter(IMessageFilter) and create your own message filter.  You can also override the WndProc method of a control or form.  To see a list of all the differnt messages look in windows.h they are all prefixed with WM.  You can also use the Spy++ tool that comes with visual studio to inspect messages from any application.

    Using Messages and Message Queues
    http://msdn.microsoft.com/en-us/library/ms644928(VS.85).aspx
    http://msdn.microsoft.com/en-us/library/ms644927(VS.85).aspx

    http://msdn.microsoft.com/en-us/library/system.windows.forms.imessagefilter.aspx
    http://msdn.microsoft.com/en-us/library/system.windows.forms.application.addmessagefilter.aspx
    • Marked as answer by jack 321 Thursday, September 25, 2008 5:53 AM
    Monday, September 22, 2008 4:32 AM
  • Hi,
    AbdElRaheim

    Thank you very much for your reply.
    That helps a lot!

    Chriz


    Thursday, September 25, 2008 10:30 PM
  • Hi, just come back to this topic. can anyone pls tell me how do I find the spy++ tool? I cannot find it in Visual Studio 2005? pls help

    Thank you
    Monday, October 06, 2008 4:27 AM
  • Hi,

    Spy++ is one of the tools that comes with Visual Studio. So if you still haven't seen it, start your Visual Stdio and open Spy++ from Tool menu.


    for more help on Spy++ follow this link 

    http://www.codeproject.com/KB/cpp/Spy__.aspx

    Cheers by Anand Ranjan
    Developer
    • Marked as answer by Royal Oak Monday, October 06, 2008 5:41 AM
    Monday, October 06, 2008 4:58 AM
  • Sweet, i found it. Thx so much.
    Monday, October 06, 2008 5:40 AM