When selecting "close" by right-clicking an application's icon in the task bar no WM_CLOSE
is sent.
What happens is that the application's main window is sent a WM_SYSCOMMAND
with wParam
set to SC_CLOSE
.
For an example on how to exploit this "feature" please see my other answer on this here.