0

i'd appreciate if someone could give me a hint :) I have my Windows Forms C# app and i put the start position to the right side of the screen. Now i'd like it to appear only when the user's cursor touches right side boundary of the screen. How can i track the position of the cursor and show the form? Thank you in advance!

echo_Me
  • 37,078
  • 5
  • 58
  • 78
Gyuzal
  • 1,581
  • 10
  • 52
  • 99
  • 2
    You are probably asking about how to set up a global hook -- see : http://stackoverflow.com/a/6871142/327083 – J... Mar 06 '13 at 11:37

1 Answers1

2

Answering in terms of decomposing the question:

That should get you started. I'm assuming you already know how to use a Timer to repeatedly do things (such as poll for the mouse position).

Community
  • 1
  • 1
AKX
  • 152,115
  • 15
  • 115
  • 172
  • But no components are visible at the time, as I understand... But I recall Cursor.Position gets updated anytime. – AKX Mar 06 '13 at 12:41
  • I take it back - this does work in the background. Neat. I still like the idea of a global hook better, though, I think. This way you respond to mouse movement rather than having to poll continuously. Maybe it's an idealist view, but think being given data is more elegant than going to get it. – J... Mar 06 '13 at 12:49
  • Well, it's more elegant, I do agree. But a global hook would receive every single mouse movement event, wouldn't it? In this case the OP probably doesn't need "instant" timing resolution. And last time I checked global hooks weren't exactly the easiest thing to get going. – AKX Mar 06 '13 at 14:58
  • Thank you! I'll try the both ways :) – Gyuzal Mar 06 '13 at 20:04