Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   Drop-down (Combo Box) (http://www.go4expert.com/forums/drop-combo-box-t8718/)

stp 8Feb2008 19:44

Drop-down (Combo Box)
 
I want to do this.Two drop-down lists

First contains hard-disk drives on my computer

http://i.data.bg/08/02/08/799505.jpg


And the second drop-down i want to contains files in the drive that i choose in the first drop-down

Here are the files

http://i.data.bg/08/02/08/799510.jpg


I am using Visual Studio C++ 6.
Can you tell me or give me links how to scan hard disks on my computer and add them to the first drop-down then to see the files in this drive in the second drop-down

shabbir 8Feb2008 21:48

Re: Drop-down (Combo Box)
 
Use GetLogicalDrives, which returns a DWORD that's a bitmask telling which drive letters are assigned. Bit 0 is drive A, bit 1 is drive B, and so on.

stp 9Feb2008 01:55

Re: Drop-down (Combo Box)
 
10x.But i have a question.
This code scan for drivers.But how to add the strings to the combo box.How to show them?

Code:

int main()

{
                char buf[1000];
        DWORD buf_size, cnt;

        buf_size = GetLogicalDriveStrings(1000, buf);

        cout << "buf_size= " << buf_size << endl;



        cout << &buf[4] << endl;


        int i;
        for(i=0;i<buf_size;i=i+strlen(&buf[i])+1)
        {cout << &buf[i] << " ";}



        return 0;
}


shabbir 9Feb2008 10:40

Re: Drop-down (Combo Box)
 
Depending on the number of bit set you need to add the character 'A' , 'B' as a string into the combo box.


All times are GMT +5.5. The time now is 10:16.