Doubt related to VC++ 5.0

I would like to know how do i browse for a directory when a button is pressed.Basically i need to locate where the cd drive is , that is the path.
I hope u got my question. Its something like when i use a normal file->Open option then i have a pull down button which allows me to browse thro' the dir. and select one particular dir. of my choice.
charulAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
>>Basically i need to locate where the cd drive is , that is the path.

If all you need is locating the CD drive, use this:

    DWORD   dwDrives;
    UINT    uDriveType;
    char    cDrive;
    char    acDriveName [   _MAX_DRIVE];

        for (   cDrive  =   0;  cDrive  <   26; cDrive++)
            {
                wsprintf    (   acDriveName,    "%c:\\",      cDrive      +      'A');

                uDriveType  =   GetDriveType(   acDriveName);
               
                if  (   DRIVE_CDROM ==  uDriveType)
                    {
                        // now acDriveName containes the drive letter of your CDROM...
                    }
            }

0
 
thresher_sharkCommented:
If you are using MFC, I recommend you go here:

http://www.codeguru.com/dialog/dir_picker.shtml

for an excellent dialog box for picking directories.
0
 
thresher_sharkCommented:
In fact, there are whole slew of them here (five total):
http://www.codeguru.com/dialog/dialog_toc.shtml

If you have any questions regarding them, please feel free to ask.  Thanks!
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
charulAuthor Commented:
I CDirDialog class ,  there is  a datatype OLECHAR,LPSHELLHOLDER  what are these exactly ? Are these .cpp files, some DLLs. so that i could plug into my code.
Please could u try to explain this ?
0
 
charulAuthor Commented:
jkr's
  i have a question, in the code that u have suggested , DRIVE_CDROM, should be typedef ?
0
 
charulAuthor Commented:
jkr's
  i have a question, in the code that u have suggested , DRIVE_CDROM, should be typedef ?
0
 
jkrCommented:
No, DRIVE_CDROM is #define'd in 'winbase.h'
0
 
charulAuthor Commented:
to JKR's
  So will i have to include 'winbase.h' file (if its a std. file) into my vc++ project, i.e whereever i use the above code mentioned ?
0
 
jkrCommented:
Well, 'winbase.h' is usually being included by 'windows.h' anyway, so you shouldn't have to do that manually...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.