3

I'm trying to make a program that would update another window text input with the color value under the mouse. The problem is that I have no idea where I put this check WM_MOUSEMOVE, since I haven't created the desktop window myself.

I tried to create own DialogBox which shows the values, but the WM_MOUSEMOVE only works within that DialogBox, not outside of it.

Rookie
  • 4,064
  • 6
  • 54
  • 86
  • You can always use a mouse hook, or something like `GetCursorPos`. – chris Nov 17 '12 at 22:39
  • I'd love to be proven wrong, but I think you just might be out of luck if what you want is to catch mouse events from *anywhere* on the desktop. In general mouse events are only caught by the widget within which the cursor is, as with your DialogBox. – Matt Phillips Nov 17 '12 at 22:52
  • @MattPhillips, A mouse hook is an event-oriented way of tracking mouse happenings anywhere. – chris Nov 17 '12 at 22:53
  • @chris The problem is that once outside the dialog box, no event is fired even if you go all crazy with your mouse. So, he can't use the GetCursorPos – Kiro Coneski Nov 17 '12 at 22:58
  • 1
    @KiroConeski, `GetCursorPos` would have to run in a loop. A hook would be called the same way when a mouse action occurs, even if it isn't for your window (if you use the right kind). – chris Nov 17 '12 at 22:59
  • +1 one for the loop idea. Although it is not a very effective solution – Kiro Coneski Nov 17 '12 at 23:02

1 Answers1

0

I'm not expert with this, but from what I've read, you need to listen for WM_INPUT message. In order to start receiving that message, your application needs to register for listening to the mouse.

Read this: http://msdn.microsoft.com/en-us/library/windows/desktop/ms645543(v=vs.85).aspx#_win32_Reading_Raw_Input

Kiro Coneski
  • 515
  • 1
  • 5
  • 20