RGBQUAD rgb;
    long *pRGB = (long*)calloc(256*256*256, sizeof(long));
    char pRed[3] = "\0";
    char pGreen[3] = "\0";
    char pBlue[3] = "\0";
    char pIndex[9] = "\0";
    int nIndex = 0;

    this->xImage.Load(this->strTmpSaveFile,CXIMAGE_FORMAT_BMP);
    this->imgWidth = this->xImage.GetWidth();
    this->imgHeight = this->xImage.GetHeight();

    for (int i=0; i<this->imgWidth; i++)
    {
        for (int j=0; j<this->imgHeight; j++)
        {
            rgb = this->xImage.GetPixelColor(i,j);

            ::itoa(rgb.rgbRed, pRed, 10);
            ::itoa(rgb.rgbGreen, pGreen, 10);
            ::itoa(rgb.rgbBlue, pBlue, 10);

            ::strcat(pIndex, pRed);
            ::strcat(pIndex, pGreen);
            ::strcat(pIndex, pBlue);

            nIndex = ::atoi(pIndex);

            pRGB[nIndex]++;   //这里出错
        }
    }
    
以上是图片统计部分代码,我初学VC++,还请大家指点一二,谢谢!

注:我想实现的是累似Photoshop里面 色彩范围 的功能。(即通过图片一个像素的颜色来取出同样颜色的区域)