I have a MFC Combobox i want to add A-Z drives to my combox at runtime Currently i am adding like this
m_cmbdrive.AddString("开发者_JS百科A:");
m_cmbdrive.AddString("B:");
m_cmbdrive.AddString("C:")
upto
m_cmbdrive.AddString("Z:");
But it seems not to be gud approach . Any modularlize code if any body can help on this ?
char drive[3];
drive[1]=':';
drive[2]='\0';
for (drive[0]='A';drive[0]<='Z';drive[0]++)
{
m_cmbdrive.AddString(drive);
}
Of course, you should check if drive is available at all before adding it into the combo, et cetera.
精彩评论