# MoveToEx Function

`Declare Function MoveToEx Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As POINTAPI) As Long`

MoveToEx sets the current point of a device. The current point is the starting point from which all graphics APIs ending with "To" (such as LineTo) begin drawing from. Other languages call this point the last point referenced. This function also puts the former current point into the variable passed as lpPoint. The function returns 0 if an error occured, or a non-zero value if successful.

hdc
  The device context of the device to set the current point of.
x
  The x coordinate of the point to set as the current point.
y
  The y coordinate of the point to set as the current point.
lpPoint
  Variable that receives the coordinate of the former current point.

Example:

    ' Draw a line from (0,0) to (100,100) in Form1
    Dim old As POINTAPI
    x = MoveToEx(Form1.hdc, 0, 0, old)  ' set (0,0) as current point
    x = LineTo(Form1.hdc, 100, 100)  ' draws from current point to (100,100)

Category: Graphics
Back to the index.