Getting Windows Mouse Coordainates

Despite having followed some instructions from a windows programming book, I don’t seem to be able to properly get the mouse coordainates. I am able to get some coordainates, but they don’t correspons with my window.

If you can get the mouse coordinates but they don’t seem to correspond with your window then it’s probably because gl windows are sometimes set up with the bottem left corner = (0, 0) not the top right corner = (0, 0), or sometimes the center of the gl surface is set to (0, 0). The GetCursorPos function will always treat the top left corner of the window as (0, 0), if you want to get the values from GetCursorPos to correspond then you will need to take this information into account i.e.

if bottom left = (0, 0) and height = window height then

mouseX = x
mouseY = Window_Height - y