I'm giving the comment as an answer (I should have done that earlier) so that it's clear that the question has been answered:

MSDN Docs for TTM_TRACKPOSITION says that the x/y values are "in screen coordinates".

I'm not totally sure, but the y-coordinate probably corresponds to the top of the caret, you could add half of the edit box height if you want to position your tooltip in the middle of the edit box.

EDIT
re Global variables, you could bundle all your global variables into a structure, allocate memory for the structure and pass the pointer of the structure using the SetWindowLongPtr API call for the edit window using the GWLP_USERDATA, the window proc can then retrieve the values using GetWindowLongPtr...

Show tooltip on invalid input in edit control
Most paradoxes involves self-reference, the only exception known to me is Yablo's paradox, however it is still debated if it is really without self-reference. So, I was wondering, are there other known paradoxes that works without self-reference? 
