|
-
May 6th, 2002, 09:27 PM
#1
Thread Starter
PowerPoster
Pretty confusing
I have 2 timers running. One of them is always running and other one is started by the first one when hit F2. Here is the code first:
PHP Code:
case WM_TIMER:
switch(wParam)
{
case TIMER_CHECKMOUSEPOS:
if(GetAsyncKeyState(VK_F2) != 0)
{
MessageBox(NULL,"The cursor position has been recognized. Now move your mouse over an empty place in Runescape and hit 'F9'", "Completed", MB_OK);
GetCursorPos(&pt1);
// itoa(pt1.x,buffer,10);
// MessageBox(NULL,buffer,"DSF",MB_OK);
Counter = 0;
KillTimer(hWnd,TIMER_CLICK);
}
if(GetAsyncKeyState(VK_F7) != 0)
{
MessageBox(NULL,"Starting the clicking loop", "Starting to click", MB_OK);
Counter = 0;
SetCursorPos(pt1.x,pt1.y);
KillTimer(hWnd,TIMER_CLICK);
SetTimer(hWnd, TIMER_CLICK,1000, NULL);
}
if(GetAsyncKeyState(VK_F8) != 0)
{
MessageBox(NULL,"Ended the clicking loop", "Ended clicking", MB_OK);
KillTimer(hWnd,TIMER_CLICK);
}
break;
case TIMER_CLICK:
if (Counter >= 300000)
{
SetCursorPos(pt2.x,pt2.y);
mouse_event(MOUSEEVENTF_LEFTDOWN, pt2.x, pt2.y, 0,0);
SetCursorPos(pt1.x,pt1.y);
Counter = 0;
}
else
{
itoa(pt1.x,buffer,10);
MessageBox(NULL,buffer,"SDF",MB_OK);
SetCursorPos(pt1.x,pt1.y);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0 , 0, 0,0);
Counter = Counter + 60000;
}
break;
}
break;
When I look at the cursor's x position in the first timer (TIMER_CHECKMOUSEPOS) when F2 is pressed, it's right and positive. But it's negative in the second timer(TIMER_CLICK) which is invoked by the first timer. Where is it changing and how would I get the actual position that I stored when I pressed F2?
-
May 7th, 2002, 09:21 AM
#2
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 7th, 2002, 10:32 AM
#3
Thread Starter
PowerPoster
It's declared as a
POINT pt1;
-
May 8th, 2002, 01:26 PM
#4
Thread Starter
PowerPoster
It's kinda due tomorrow so maybe I can get some credits if I finish this...
-
May 10th, 2002, 04:52 AM
#5
It may be too late now (wasn't here, sorry), but you must declare it as static so it's values aren't lost between function calls.
Don't forget, WinProc is called one for each message, no less, no more.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|