Solved

Doubt related to VC++ 5.0

Posted on 1998-11-11
9
174 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

706 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

20 Experts available now in Live!

Get 1:1 Help Now