请教out参数的用法
lxkim 2005-03-04 12:24:09 [StructLayout(LayoutKind.Sequential)]
public class POINT
{
public int x;
public int y;
public POINT()
{
}
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
}
[DllImport("user32.dll")]
static extern bool GetCursorPos(out POINT lpPoint);
GetCursorPos的参数是out型的
在调用时
POINT lppoint = new POINT(0,0);
GetCursorPos(out lppoint);
label1.Text = lppoint.x.ToString();
label2.Text = lppoint.y.ToString();
为什么会出错?提示未将对象引用设置到对象实例