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(hWndTIMER_CLICK,1000NULL);
            }

                    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_LEFTDOWNpt2.xpt2.y0,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_LEFTDOWN00,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?