| View previous topic :: View next topic |
| Author |
Message |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Tue Jul 10, 2007 10:32 am Post subject: Pointer Issue c++ |
|
|
Im writing up a macro program for rs and i started with the ui and the recording of points. I declared:
POINT *inv[29]; //to hold each inv slot point and rather than me reference inv[0], i made the array larger.
int cur=1; //for tracking through recording.
THen to record the points I have this:
if (setup==true & table->vkCode==162){
// ShowMessage(cur);
GetCursorPos(inv[cur]);
cur++;
up to here it works fine.
Then to play them back, I get an access error. Im not very knowledgeable on pointers, maybe you guys can help:
POINT *p = inv[cur];
SetCursorPos(p->x,p->y);
cur++;
| Description: |
|
| Filesize: |
97.05 KB |
| Viewed: |
4491 Time(s) |

|
_________________
|
|
| Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Tue Jul 10, 2007 1:31 pm Post subject: |
|
|
I don't see the need for a pointer at all in this situation, but if you insist..
Is inv allocated memory at that point in execution? It appears to be a global variable and you can easily go wrong with those..
_________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Tue Jul 10, 2007 1:36 pm Post subject: |
|
|
sorcerer,
when you do
260 chars are allocated for you.
|
|
| Back to top |
|
 |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Tue Jul 10, 2007 2:39 pm Post subject: |
|
|
id rather not use pointers, but GetCursorPos requires one. If theres a way around this, id be glad to know.
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Tue Jul 10, 2007 2:42 pm Post subject: |
|
|
| No it doesn't. It accepts two integers.
|
|
| Back to top |
|
 |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Tue Jul 10, 2007 8:48 pm Post subject: |
|
|
im using bcb. It sais that it requires a pointer to a point. I tried giving it two integers, but it sais that it is two few parameters.
_________________
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25814 Location: The netherlands
|
Posted: Wed Jul 11, 2007 5:17 am Post subject: |
|
|
p->x and p->y are also just 2 integers (dereferenced from the p object)
so why wouldn't SetCursorPos(0,0) work?
or
int x,y;
SetCursorPos(x,y);
and if it REALLY needs a pointer and not a point then
SetCursorPos(&x,&y);
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Wed Jul 11, 2007 10:30 am Post subject: |
|
|
SetCursorPos takes two integers, but GetCursorPos takes a pointer to a point.
I recently figured out that in getcursorpos, i could do &inv, and not declare it a pointer at all.
_________________
|
|
| Back to top |
|
 |
|