g, _
      ByVal Blue As Long _
   ) As Long
Dim lMinIndex As Long
   
   If m_hPal Then
      
      Dim lRGB As Long
      
      lRGB = (Red And &amp;HFF&amp;) + (Green And &amp;HFF&amp;) * &amp;H100&amp; + (Blue And &amp;HFF&amp;) *
       &amp;H10000
      lMinIndex = GetNearestPaletteIndex(m_hPal, lRGB)
   
   Else
   
      Dim i As Long
      Dim lER As Long, lEB As Long, lEG As Long
      Dim lMinER As Long, lMinEB As Long, lMinEG As Long
         
         lMinER = 255: lMinEB = 255: lMinEG = 255
