-
April 16th, 2010, 04:31 PM
#1
Dev C++ LPPOINT
ok so I have this part of the code in my code:
LPPOINT Pos;
GetCursorPos(Pos);
its a program my friend wants me to make.
Well everytime I try to use Pos.y or Pos.y.value the idw it keeps coming back saying y hasn't been declared,why is that?
This makes no sense to me *clueless*
thanks
-
April 16th, 2010, 04:40 PM
#2
Re: Dev C++ LPPOINT
In the Windows SDK, 'LPPOINT' is a pointer to a POINT struct. So:
Code:
POINT Pos;
GetCursorPos(&Pos);
should work.
Viggy
-
April 16th, 2010, 05:17 PM
#3
Re: Dev C++ LPPOINT
Originally Posted by MrViggy
In the Windows SDK, 'LPPOINT' is a pointer to a POINT struct. So:
Code:
POINT Pos;
GetCursorPos(&Pos);
should work.
Viggy
Nah that didn't work. It just said something about can't convert tag point
#include <cstdlib>
#include <windows.h>
#include <iostream>
#include <fstream>
using namespace std;
ofstream file("c:\\mouse.txt");
int main(void)
{
LPPOINT Pos;
GetCursorPos(&Pos);
cout << Pos.y<<endl;
while(Pos=0){
}
file<<"hello world";
system("PAUSE");
return (0);
}
Errors:
10 C:\Master Backup\g backup\Projects\Event Tasker\main.cpp cannot convert `tagPOINT**' to `tagPOINT*' for argument `1' to `BOOL GetCursorPos(tagPOINT*)'
11 C:\Master Backup\g backup\Projects\Event Tasker\main.cpp `y' has not been declared
11 C:\Master Backup\g backup\Projects\Event Tasker\main.cpp request for member of non-aggregate type before '<<' token
-
April 16th, 2010, 05:30 PM
#4
Re: Dev C++ LPPOINT
You are still making the same mistake pointed out by MrViggy. Use POINT not LPPOINT.
Get Microsoft Visual C++ Express here or CodeBlocks here.
Get STLFilt here to radically improve error messages when using the STL.
Get these two can't live without C++ libraries, BOOST here and Loki here.
Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
Always use [code] code tags [/code] to make code legible and preserve indentation.
Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.
-
April 16th, 2010, 06:00 PM
#5
Re: Dev C++ LPPOINT
ok I'll try point again, maybe it will work. I tried it before and it said POINT doesn't name a type
-
April 16th, 2010, 06:15 PM
#6
Re: Dev C++ LPPOINT
Originally Posted by Senith
ok I'll try point again, maybe it will work. I tried it before and it said POINT doesn't name a type
That because there is NO type "POINT" in windows.h
Tip: if you're using Visual Studio, hold your mouse over the text LPPOINT and it will bring a box out that states that LPVOID is a typedef for a pointer to a struct named tagPOINT. LP is Hungarian notation for long pointer which means it only points to a tagPOINT.
tagePOINT pos; // or LPPOINT pos = new tagPOINT;
GetCursorPos(&Pos); // or GetCursorPos(Pos);
cout << Pos.y;
-
April 16th, 2010, 08:38 PM
#7
Re: Dev C++ LPPOINT
MSDN disagrees.
The struct is typedeffed to POINT.
Get Microsoft Visual C++ Express here or CodeBlocks here.
Get STLFilt here to radically improve error messages when using the STL.
Get these two can't live without C++ libraries, BOOST here and Loki here.
Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
Always use [code] code tags [/code] to make code legible and preserve indentation.
Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|