Declare Function SetPixel Lib "gdi32" Alias "SetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long

As for the coords to use, I dont remember the exact equation, you might look for it on google, or just dig up an old geomtry book