Forcing Cursor Redraw

This is a discussion on Forcing Cursor Redraw within the Windows Programming forums, part of the Platform Specific Boards category; Is there a way to force the Win32 program to redraw a cursor? I am trying to write a program ...

  1. #1
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728

    Forcing Cursor Redraw

    Is there a way to force the Win32 program to redraw a cursor? I am trying to write a program where when the user pushes the right mouse button the cursor changes to a new cursor using Set and LoadCursor, but windows doesn't redraw it until the mouse moves again unfortunately. I want to force it to redraw so that the user can see the change even if the mouse doesn't move.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Don't know, but since mouse movement (ie cursor movement)causes the cursor to be redrawn you might consider trying GetCursorPos to retrieve the cursor's position and then using that position with SetCursorPos to 'moves the cursor to the specified screen coordinates'.

  3. #3
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    Try using ShowCursor() to hide, and then show the cursor. This should force a redraw.

  4. #4
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Can you get window handle to it and send a WM_PAINT message?

  5. #5
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Thanks everyone, I got it working now using the SetCursorPos function like you suggested Ken.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Forcing code conventions
    By audinue in forum Tech Board
    Replies: 28
    Last Post: 03-31-2009, 09:46 AM
  2. forcing window repainting after putting back caption
    By underthesun in forum Windows Programming
    Replies: 2
    Last Post: 02-05-2005, 10:13 PM
  3. Forcing variables to be declared at top of a function
    By Jeremy G in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2003, 09:55 PM
  4. Forcing an enum to int?
    By Sebastiani in forum C++ Programming
    Replies: 14
    Last Post: 11-03-2002, 12:11 PM
  5. Forcing 30 day break
    By gamegod3001 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 10-06-2001, 12:25 AM

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