开发者

MFC Combobox Add A-Z Drives?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜