Caveats

You should remember that this hook intercepts sent messages only. During the modal loop, no messages can be posted to the thread’s message queue.

Some additional MSGF_ messages are defined in Winuser.h, but this hook does not currently implement them. These messages are listed here:

Public Const MSGF_MAINLOOP = 8      'Not used with MsgFilter Hook
Public Const MSGF_MAX = 8           'Not used with MsgFilter Hook
Public Const MSGF_MESSAGEBOX = 1    'Not used with MsgFilter Hook
Public Const MSGF_MOVE = 3          'Not used with MsgFilter Hook
Public Const MSGF_SIZE = 4          'Not used with MsgFilter Hook
Public Const MSGF_USER = 4096       'Not used with MsgFilter Hook
Public Const MSGF_NEXTWINDOW = 6    'Not used with MsgFilter Hook

Even though this hook intercepts a subset of the messages that hooks such as WH_CALLWNDPROC or WH_CALLWNDPROCRET intercept, you should still watch how this hook affects your application’s performance.

Get Subclassing and Hooking with Visual Basic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.