该接触C++不久,如果提的问题太白,大家可别用鸡蛋砸我呀 :》
想用GetCursorPos来获取鼠标的当前位置,可一编译问题一大堆,资料查了半天,楞是改不不来,大家给把把脉:
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include<Windows.h>
#include "gdiplus.h"
using namespace std;int _tmain(int argc, _TCHAR* argv[])
{ Point *Position=new Point();
GetCursorPos(Position);
cout<<"The position is"<< x<<Position->x<< y <<Position->y<<endl;
return 0;
}

程序很简单,可是.....
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(14) : error C2065: 'Point' : undeclared identifier
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(14) : error C2065: 'Position' : undeclared identifier
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(14) : error C2061: syntax error : identifier 'Point'
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(15) : error C2065: 'Position' : undeclared identifier
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(16) : error C2065: 'x' : undeclared identifier
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(16) : error C2065: 'Position' : undeclared identifier
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(16) : error C2227: left of '->x' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(16) : error C2065: 'y' : undeclared identifier
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(16) : error C2065: 'Position' : undeclared identifier
1>d:\test\cursorpos\cursorpos\cursorpos.cpp(16) : error C2227: left of '->y' must point to class/struct/union/generic type
1>        type is ''unknown-type''Point不是自带的类吗?难道还要定义?还有,这用就调用GetCursorPos API,有问题吗?