1

I need to draw an icon that moves approximately in sync with mouse cursor and is always on top of all windows. OS: Windows 7

I have a solutions that work to some extend by drawing my icon in a top most transparent window. There are some major drawbacks in this solution since that top most window interferes with other top most windows and some full screen apps do not work correctly. Examples are start menu and task bar that will overlay my window if I do not regulary set it to be top most. For some full screen applications performance of updating position of window with icon hugely drops and it does not follow mouse smoothly.

There is another method that I came across where an icon is drawn directly to the device context of desktop Draw mouse pointer icon?. This solution has a drawback that there seems to be no good way of how to remove "trail", especially if desktop content changes quickly.

So my question: is there an ultimate solution that does not have the above mentioned problems? Is it possible to draw above all windows in the "layer" of mouse cursor? Or make a second mouse cursor with my custom icon that I will control (I know that widows can display two independently controlled mouse cursors like CPNMouse)?

Can someone point me to the right direction?

Thanks!

Community
  • 1
  • 1
Aleksey
  • 11
  • 3

1 Answers1

0

Use a top-most window with transparency set via WS_EX_LAYERED / UpdateLayeredWindow. If you set the WS_EX_TRANSPARENT style as well then the window won't intercept mouse input.

Jonathan Potter
  • 36,172
  • 4
  • 64
  • 79
  • This is what I already do right now (please read the question attentively), but there are drawbacks for full screen apps (like games), and you need to set that window to be top most regulary so other top most windows do not overlay it. – Aleksey Aug 23 '12 at 09:09