This seems to happen because TrackPopupMenu returns as soon as the WM_LBUTTONDOWN is received. That message is correctly purged. The problem comes from the subsequent WM_LBUTTONUP message. This patch is not a clean solution, but keeps the problem local.