i'm currently using the following code to get the color of the pixel the mouse is over...

Code:
 On Error Resume Next
  Dim cursorpos As POINTAPI
  Dim rDC As Long, rPixel As Long
  Call GetCursorPos(cursorpos)
  rDC& = GetDC(0&)
  rPixel& = GetPixel(rDC&, cursorpos.X, cursorpos.Y)
  Call ReleaseDC(0&, rDC&)
  color& = rPixel&
It works fine except for there's a minor problem. When i use it in a timer or a loop for a longish period of time (like anywhere between 4-10 minutes), the program starts lagging my computer. It seems to be eating up memory somehow. Anyone know how i might change this code so it could run for hours on end without any trouble with lag?

thanks.