获取鼠标坐标

void MyPaint(HDC hdc,LPARAM lparam)
{
   int x,y;
   char str[20]="";

   x=LOWORD(lparam);//取得鼠标的x坐标值
   y=HIWORD(lparam);//取得鼠标的Y坐标值

   SetTextColor(hdc,RGB(255,0,0));

   TextOut(hdc,10,10,"鼠标坐标",strlen("鼠标坐标"));
   sprintf(str,"x坐标:%d",x);
   TextOut(hdc,30,30,str,strlen(str));
   sprintf(str,"y坐标:%d",y);
   TextOut(hdc,30,50,str,strlen(str));
}

存在问题????

typedef UINT WPARAM;
typedef LONG LPARAM;
WPARAM是无符号整形,LPARAM是long型。

你可能感兴趣的:(获取)