I put an icon in the notification area using Shell_NotifyIcon and specified a window (that receives notification messages from this icon) and a user message (that is sent in such cases) in the NOTIFYICONDATA structure. It works correctly, as a response to a right click on the icon, this user message is sent. The wParam is an id of the icon and lParam is the message (e.g. WM_RBUTTONDOWN). If I want, let's say, to close the app on a right click, I can. Problem is, that I want a popup menu to be displayed and need the x and y coordinates for TrackPopupMenuEx(). How can I obtain them when wParam and lParam are used as mentioned above?

I tried using GetMouseMovePointsEx to get actual mouse cursor coordinates, but this code:
Code:
MOUSEMOVEPOINT mmp_out = {0}, mmp_in = {0};
int i = ::GetMouseMovePointsEx(	sizeof MOUSEMOVEPOINT, mmp_in, mmp_out, 1, GMMP_USE_DISPLAY_POINTS);
always returns i == -1.