GetPixel is an API. You can declare this at the top of your code Private Declare Function GetPixel Lib "gdi32" _ (ByVal hDC As Long, _ ByVal x As Long, _ ByVal y As Long) As Long hDC is a device context handle, needed when working a display or printer. This can be compared to HWND when your are working with window object, one use of HDC on the other hand is for drawing.