I have an application that creates an icon in the Windows panel. When the user right-clicks, a context menu is displayed. The application works fine until DPI scaling is done from the control panel. E.g. when the DPI scaling is set to 150%, the context menu will be displayed correctly, but when I zoom to 125%, the context menu moves and displays at a position far from the tray icon. This does not happen if I use GetCursorPos()instead of GET_X_LPARAM(wParam)and GET_Y_LPARAM(wParam)to get the coordinate of the mouse.
The MSDN documentation on NOTIFYICONDATA( https://msdn.microsoft.com/en-us/library/windows/desktop/bb773352(v=vs.85).aspx ) the data structure says that GET_X_LPARAM(wParam), and GET_Y_PARAM(wParam)inside the callback function that handles , should give X and Y coordinates of the click event (which is used to call the context menu of the tray icon). This does not happen when the DPI changes according to what is written above. however continues to give the correct meaning. uCallbackMessageright-mouse-buttonGetCursorPos()
I feel that they should always report the same meaning.
EDIT 1 . Suppose that after a right-click, the mouse did not move, in which case both should give the same coordinates.
EDIT 2 - Repro (Error Playback Information)
, Picotorrent.
NotifyIconController.cpp:: NotifyIconController:: Execute() , GET_X_LPARAM(), GetCursorPos() ( ).
TCHAR debug_string[50];
_stprintf_s(debug_string,sizeof(debug_string), _T("\n\n[wParam :(x,y)=(%d,%d)]\n"), GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam));
OutputDebugString(debug_string);
POINT pt;
GetCursorPos(&pt);
_stprintf_s(debug_string,sizeof(debug_string),_T("[GetCursorPos:(x,y)=(%d,%d)]\n"), pt.x, pt.y);
OutputDebugString(debug_string);

Picotorrent . , . X, Y GET_X_LPARAM (wParam) GET_Y_LPARAM (wParam).
. , DPI.
, DPI 150%. DPI .

, DPI 125%. , . , , GET_X_LPARAM() GetCursorPos() ( , , ). , . , GET_X_LPARAM (wParam) GET_Y_LPARAM (wParam), X Y , GetCursorPos().

.
[wParam :(x,y)=(1539,1045)]
[GetCursorPos:(x,y)=(1539,1045)]
[wParam :(x,y)=(1606,1054)]
[GetCursorPos:(x,y)=(1927,1265)]
Also see the following screenshot.
alt = "GET_X_LPARAM () and GetCursorPos () return different values ββwhen changing DPI scaling">From the output, we can clearly see that initially GET_X_LPARAM () and GetCursorPos () coordinate the coordinate values, but they do not do this when changing the scaling value.