0

Imagine a case where you want to duplicate (emulate) mouse cursor movements in your window (as in drawing a cursor overlay). I have a window and I want a very exact similar mouse icon moves when user moves the mouse but in boundaries of my window (ie movements are scaled to boundaries of my window). It means if there are 3 monitor setup and my window is full size in monitor 2 (the middle one). Moving cursor from very left of monitor 1 to very right of monitor 3 will cause a duplicated cursor in my window moves from very left of my window to very right of my window.

I have had flickering experiences with GDI before. So before I wanted to implement this I was wondering what are the best (and hopefully easiest/fastest coding) ways to implement this. (I had setup a RAW input so I get a message for every movement of mouse)

Here are my ideas : GDI : maybe XOR drawing or clearing/drawing into buffer. GDI+ : ? DirectDraw : overlay methods ? (I haven't yet fully looked at them) Direct3D or Windows Media APIs ?

My main window is also updating itself in a timer (500ms) and just bitblt into that.

Also if anybody knows of similar project or tutorial or sources that would be great.

Thanks

Roozbeh G
  • 427
  • 4
  • 18
  • I am confused, `I have a window and I want a very exact similar mouse icon moves when user moves the mouse but in boundaries of my window (ie movements are scaled to boundaries of my window).`, you already have a mouse cursor in your window, what duplicated mean here? – zdd Jun 17 '14 at 05:53
  • No I meant even if mouse cursor(real one) goes outside my window...I will still continue to draw it somewhere. Imagine a three monitor setup that (from left to right monitors are labeled as 1-2-3) and my window is full size in monitor 2. Moving cursor from very left of monitor 1 to very right of monitor 3 will cause duplicated mouse move from very left of my window to very right of my window. – Roozbeh G Jun 17 '14 at 18:18
  • You should update your question. – zdd Jun 18 '14 at 01:13

1 Answers1

0

If you have all your graphics, except the cursor, pre-rendered into a bitmap, then the cursor can be rendered by erasing, using a part of the bitmap, and clipping, then redrawing the cursor in a new spot. That is the fastest technique. GDI+ is fast enough but GDI also works fine.

Frank Hileman
  • 1,159
  • 9
  • 19