C28623

avviso C28623: cast senza segno delle coordinate GetMessagePos(). Usare GET_X_LPARAM/GET_Y_LPARAM anziché LOWORD/HIWORD

I sistemi con più monitor possono avere coordinate x negative e coordinate y. In questi sistemi, GetMessagePos può quindi restituire valori negativi. Tuttavia, poiché LOWORD e HIWORD considerano le coordinate come quantità non firmate, non devono essere usate.

Esempio

PREfast segnala l'avviso per l'esempio seguente.

DWORD dw = GetMessagePos();
POINT ppt;

ppt.x = LOWORD(dw);
ppt.y = HIWORD(dw);

Nell'esempio seguente viene evitato l'errore .

DWORD dw = GetMessagePos();
POINT ppt;

ppt.x = GET_X_LPARAM(dw);
ppt.y = GET_Y_LPARAM(dw);