ultra slow cursor

This is a discussion on ultra slow cursor within the Windows Programming forums, part of the Platform Specific Boards category; hello! I would like to reduce by a factor 100 the ratio of mouse to cursor displacement. I tried thid ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    1

    ultra slow cursor

    hello!
    I would like to reduce by a factor 100 the ratio of mouse to cursor displacement. I tried thid piece of code (for a factor 10) but it doesn't work:
    Code:
    #include <windows.h>
    int main(int argc, char *argv[])
    {
         static POINT pt;
    	 POINT pt2;
    	 POINT pt3;
         BOOL bContinue = TRUE;
         const SHORT Mask = 32768;
    	GetCursorPos(&pt);
         while (bContinue)
         {
              if (GetKeyState(VK_ESCAPE) & Mask)
                   bContinue = FALSE;
              
    		  
    		 
    			  GetCursorPos(&pt2);
    			  
    			  pt3.x = (pt2.x - pt.x)/10 + pt.x;
    				pt3.y = (pt2.y - pt.y)/10 + pt.y;
               SetCursorPos(pt3.x,pt3.y);
             
    		  
    		  GetCursorPos(&pt);
           Sleep(1);
         }
    	  
         return 0;
    }
    the cursor jumps continously from pt to pt2.
    any idea?
    thanks!

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Set mouse speed to slow:
    Code:
    SystemParametersInfo(SPI_SETMOUSESPEED,0,(void*)1,0);
    Set mouse speed back to normal:
    Code:
    SystemParametersInfo(SPI_SETMOUSESPEED,0,(void*)10,0);
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> the cursor jumps continously from pt to pt2.

    That's becuase the system displays the cursor where it's suppose to go for that 1ms, and then back again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Restoring the Cursor
    By leojose in forum Windows Programming
    Replies: 8
    Last Post: 06-09-2005, 12:29 PM
  2. Custom Animated Cursor
    By willc0de4food in forum Windows Programming
    Replies: 3
    Last Post: 05-13-2005, 10:05 PM
  3. cursor question
    By GodLike in forum Windows Programming
    Replies: 3
    Last Post: 05-09-2002, 06:14 PM
  4. cursor remains in openGL fullscreen
    By Ken Fitlike in forum Game Programming
    Replies: 5
    Last Post: 03-14-2002, 07:52 PM
  5. Mouse in 800x600 24Bit Mode?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 11-11-2001, 12:38 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21