Ich probiere grade nen kleinen PixelBot zu schreiben.
Folgendes habe ich jetzt aus Testgründen geschrieben:
Code:
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
LPPOINT CursorPos;
while(true)
{
Sleep(100);
GetCursorPos(CursorPos);
cout << CursorPos.x << endl;
cout << CursorPos.y << endl;
}
}
"`x' has not been declared"
"request for member of non-aggregate type before '<<' token "
"`y' has not been declared"
"request for member of non-aggregate type before '<<' token "
Da ich ziemlich neu in C++ bin weiß ich nicht was das bedeutet. Daraufhin habe ich mir den Source eines anderen PixelBots angeschaut und dieser realisiert das so:
Code:
int GetCursorX() {
LPPOINT p = new POINT;
GetCursorPos(p);
return p->x;
}
int GetCursorY() {
LPPOINT p = new POINT;
GetCursorPos(p);
return p->y;
}
Seine Methode funktioniert komischerweise.
Also:
Code:
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
LPPOINT CursorPos;
while(true)
{
Sleep(100);
GetCursorPos(CursorPos);
cout << CursorPos->x << endl;
cout << CursorPos->y << endl;
}
}
Kann mir jemand helfen und mich ein bisschen aufklären?
Klassen und Objekte lerne ich bald in meinem Tutorial.
Danke,
MfG,
CracKPod






