What is the point in posting this message to windows windows?

  • one
  • Thank you, @ Kotik_hochet_kushat. - Salivan
  • One of the main tasks is to check that the message queue of the window is "live", not suspended ... If the system returned 0 during the interval you specified (SendMessageTimeout method), then the queue is alive, otherwise - "Houston, we have problems" :) - 23W

2 answers 2

Sometimes, when you lose focus, the pop-up menu in System Tray does not close when you lose focus. Therefore, when processing messages for a pop-up menu, you need to bring a window to the foreground and send him a WM_NULL message.

  • An application sends a WM_NULL message if it wants to send a message, which the recipient should ignore. - vdk company
  • Thanks, of course, for a practical example. This is only a plus. I know that this message is ignored by the recipient ... but if the message is NOT processed in any way, is the meaning of it? After all, another menu can be sent to the pop-up menu, which will bring it to the top of all Windows windows, for example, it will do one of the many window “activation” functions (SetForeground, for example) ... - Salivan

WM_NULL is often used in hooks, when you cannot "cancel" a message, you can only change it ,

Here, so that the changed message does not find its destination in the hierarchy of window handlers, it is marked with WM_NULL