0

So here's my problem: I want to get the cursor position which is in my directx 9 application. Not the default GetCursorPos(&rect). It should only be the mouse position inside of my application so for example if I draw a Rect at 100, 100, 200, 200 and when I hover my mouse over the rect the mouse x and y should be somewhere between 100 and 200. Is there any function like
myDevice->GetCursorPosition(), because I only saw a SetCursorPosition method.

TomBombadil
  • 351
  • 1
  • 4
  • 15
  • couldnt you just get the global mouse position and add the position of the rekt, so eg if you get 10,10 from `GetCursorPos(&rect)` inside a rect with min position 100,100, you could add the minimum width and height values to get the correct value? – TomBombadil Mar 29 '18 at 09:45
  • but wouldn't there be some problems if I change the resolution – myStackOverflows Mar 29 '18 at 09:53
  • 1
    Sounds like you want to use [`ScreenToClient`](https://msdn.microsoft.com/en-us/library/dd162952%28VS.85%29.aspx) as described here: [Get current cursor position](https://stackoverflow.com/questions/6423729/get-current-cursor-position) – UnholySheep Mar 29 '18 at 10:08
  • @UnholySheep Thanks! Works fine. Could you please write this as an anwser so I could mark it as the best solution. Would be nice. – myStackOverflows Mar 29 '18 at 10:23
  • 1
    Since it already exists as an answer it should be closed as a duplicate instead – UnholySheep Mar 29 '18 at 10:42

0 Answers0