I am coding little fun gadget. I want to be able to draw second (or more) mouse pointer icons at different location than the original mouse but to move it according to move of original mouse.
I know how to track movement of the mouse but I dunno how to draw/redraw mouse pointer; can anyone help?
This could be done like:
grab the current mouse cursor from your application, using
LoadCursor(). Just specify NULL, and the cursor you want. Or just load a bitmap for the cursor. Now, you have a bitmap.Next step is to get the Device context of your Desktop:
GetWindowDC(NULL). This will give you the opportunity to draw on the desktop anywhere.There is a huge chance that you will need to apply
CreateCompatibleBitmap()to the Image at #1 with the DC obtained at #2.Now, use some
BitBlt()to copy bits OUT from the DC obtained at #2 into a save image (YOU will need to create these) from the position you want to put your cursor.Now, put the image obtained at #3 onto the DC of the Desktop obtained at #2 at the position you want.
When the user moved the mouse restore the image on the desktop with the saved data at #4. Release all the stuff you don’t need (yes, this is mandatory).
And restart from #1.
These two more links might help:
Bitmaps, Device Contexts and BitBlt
Capturing an Image
Good luck!