新手有关问题,小弟我想在屏幕上输出鼠标坐标,总是出错,请帮一下忙
新手问题,我想在屏幕上输出鼠标坐标,总是出错,请帮一下忙.
代码如下.
LPPOINT pPoint;
::GetCursorPos(pPoint);
::ScreenToClient(hWnd,pPoint);
hdc=GetDC(hWnd);
wsprintf(str,TEXT( "x:%ld ||| y:%ld "),pPoint-> x,pPoint-> y);
TextOut(hdc,100,100,str,20);
TextOut(hdc,200,200,+_T( "fdsfsd "),6);
ReleaseDC(hWnd,hdc);
是一个运行时错误.运行总是出现pPoint 无法获取值.
我用的是VS2005 看网上的例子 都是PPOINT 现在GetCursorPos的参数怎么是LPPOINT 不解. 请问上面代码哪里错的.
------解决方案--------------------
POINT pPoint;
::GetCursorPos(&pPoint);
代码如下.
LPPOINT pPoint;
::GetCursorPos(pPoint);
::ScreenToClient(hWnd,pPoint);
hdc=GetDC(hWnd);
wsprintf(str,TEXT( "x:%ld ||| y:%ld "),pPoint-> x,pPoint-> y);
TextOut(hdc,100,100,str,20);
TextOut(hdc,200,200,+_T( "fdsfsd "),6);
ReleaseDC(hWnd,hdc);
是一个运行时错误.运行总是出现pPoint 无法获取值.
我用的是VS2005 看网上的例子 都是PPOINT 现在GetCursorPos的参数怎么是LPPOINT 不解. 请问上面代码哪里错的.
------解决方案--------------------
POINT pPoint;
::GetCursorPos(&pPoint);