Solved

Doubt related to VC++ 5.0

Posted on 1998-11-11
9
175 Views
Last Modified: 2010-04-02
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.
0
Comment
Question by:charul
  • 4
  • 3
  • 2
9 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1177595
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
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1177596
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
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 1177597
>>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
 

Author Comment

by:charul
ID: 1177598
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:charul
ID: 1177599
jkr's
  i have a question, in the code that u have suggested , DRIVE_CDROM, should be typedef ?
0
 

Author Comment

by:charul
ID: 1177600
jkr's
  i have a question, in the code that u have suggested , DRIVE_CDROM, should be typedef ?
0
 
LVL 86

Expert Comment

by:jkr
ID: 1177601
No, DRIVE_CDROM is #define'd in 'winbase.h'
0
 

Author Comment

by:charul
ID: 1177602
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
 
LVL 86

Expert Comment

by:jkr
ID: 1177603
Well, 'winbase.h' is usually being included by 'windows.h' anyway, so you shouldn't have to do that manually...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now