Transparent Texture Map question

How do you set the Alpha value for specific colors to be transparent in the texture map?

I’m also curious if there is an easy way to do this. As of now I just load the bitmap textures then convert them to 32-bit changing the alpha values based on the the pixel color. Then I create the RGBA texture.

// convert 24-bit data to 32-bit
pData = new unsigned char [m_widthm_height4];
unsigned int row,col;
for (row=0;row<m_height;row++)
{
for (col=0;col<m_width;col++)
{
int index=rowm_width4+col4;
int indexIn=row
m_width3+col3;
pData[index]=m_pRGB[indexIn];
pData[index+1]=m_pRGB[indexIn+1];
pData[index+2]=m_pRGB[indexIn+2];
pData[index+3]=255;
}
}
if (m_pRGB)
delete[] m_pRGB;
m_pRGB=pData;

// add alpha color mask
int i;
int count=m_widthm_height;
unsigned int
pData=(unsigned int*)m_pRGB;
for (i=0;i<count;i++)
{
if ((pData[i] & 0x00FFFFFF)==color)
pData[i]= (((alpha << 24) & 0xFF000000)|color);
}