CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Location
    Ukraine
    Posts
    228

    Talking Do you use WM_NULL?

    I have found funny windows message.
    It is described in MSDN so:

    WM_NULL
    The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.

    I propose competition on the best idea how to use it

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234
    Better, read all the documentation before -ing and say "funny".
    From MSDN
    WM_NULL
    [...]
    Remarks
    For example, if an application has installed a WH_GETMESSAGE hook and wants to prevent a message from being processed, the GetMsgProc callback function can change the message number to WM_NULL so the recipient will ignore it.

    As another example, an application can check if a window is responding to messages by sending the WM_NULL message with the SendMessageTimeout function.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: Do you use WM_NULL?

    Originally posted by Alex Rest
    I have found funny windows message.
    .
    .
    .
    An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.
    I do not see anything funny about that. Just to give you few examples:

    This message is used to test if application is still responding and is not hang. Task manager does that by using SendMessageTimeout with WM_NULL.

    WM_NULL is also used to filter messages in WH_GETMESSAGE hook. Returning 0 from a hook does not prevent from processing a message. Replacing message with WM_NULL will filter message properly.

    Another use is ActiveX control when you decide that it has toolbar and tooltips. Normally application message pump calls PreTranslateMessage; since ActiveX control does not have one, message hook can call PreTranslateMessage and if handled replace original message with WM_NULL.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  4. #4
    Join Date
    May 2002
    Location
    Ukraine
    Posts
    228
    O!
    I am agree.
    It is useful.
    Thanks for good examples.

  5. #5
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Hi Alex,

    Just joking...
    You were like a Java-fan wondering: "What is NULL good for???"


    Keep ahead!
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured