大伙帮我看看这个API的调用,GetCursorPos!
tavor 2003-10-20 12:40:09 public Point p=new point(0,0);
[DllImport ("user32.dll", EntryPoint="GetCursorPos")]
public static extern bool GetCursorPos(Point lpPoint);
private void button1_Click(object sender, System.EventArgs e)
{
GetCursorPos(p);
MessageBox.Show (p.X +" "+p.Y );
}
可是MessageBox确显示结果为“0 0”,
而GetCursorPos在MSDN中这么说
The GetCursorPos function retrieves the cursor's position, in screen coordinates.
Syntax
BOOL GetCursorPos( LPPOINT lpPoint
);
Parameters
lpPoint
[out] Pointer to a POINT structure that receives the screen coordinates of the cursor.
Return Value
If the function succeeds, the return value is nonzero.
这里的意思应该是说,返回的结果是鼠标在当前屏幕的位置,并把这个存储到参数的lpoint中。
请大伙帮 忙给我看看。