Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/104068

From BetaArchive Wiki

DOC: Determining Message Removal from WH_GETMESSAGE Hook

Q104068



The information in this article applies to:


  • Microsoft Windows Software Development Kit (SDK) 3.1





SUMMARY

A WH_GETMESSAGE hook is called each time PeekMessage or GetMessage is called. The wParam parameter of the hook indicates whether the message is being removed from the queue or merely being looked at.

If PeekMessage is called with the PM_NOREMOVE flag, the message will not be removed from the queue. A WH_GETMESSAGE hook is called each time PeekMessage or GetMessage is called, and therefore the hook may be called more than once for the same message if PeekMessage is called with PM_NOREMOVE.

The hook can determine whether the message is being removed by using the information in the wParam parameter. wParam contains the PM_* flags that were used in the PeekMessage call. GetMessage calls PeekMessage with the PM_REMOVE flag. The Windows 3.1 SDK does not document the value of wParam. It will be documented in future versions.

Note that PM_NOREMOVE is defined as 0x0000, and therefore must be used carefully in any Boolean conditional code. Code similar to the following may be used in the hook:

   if (wParam & PM_REMOVE)

       Message is being removed;
   else Message is being looked at but not being removed. The hook

       may be called again for the same message. 

Additional query words:

Keywords : kbdocfix kb16bitonly kbHook kbSDKPlatform kbSDKWin16
Issue type :
Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310


Last Reviewed: July 22, 1999
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.