开发者

MFC Combobox Add A-Z Drives?

开发者 https://www.devze.com 2023-01-17 15:49 出处:网络
I have a MFC Combobox i want to add A-Z drives to my combox at runtime Currently i am adding like this

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

精彩评论

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

关注公众号