GetColorCount Example for C++ 4.0 and later

This example displays a message box showing the number of unique colors in the control's current bitmap.

// Declare local variables.
char szMessage[80]; // Buffer for the MessageBox string 
long NumberOfColors; // Number of colors in the bitmap 

// Get the number of colors in the bitmap.
NumberOfColors = m_Lead1.GetColorCount();

// Display the result in a message.
wsprintf( szMessage, "The bitmap has %ld colors", NumberOfColors );
MessageBox(szMessage, "Notice");