Solved

SHBrowseForFolder full example required!

Posted on 2003-12-05
3
732 Views
Last Modified: 2013-11-20
Hi

Can anyone give me a full example of how to use SHBrowseForFolder? To give a complete overview, I want the user to locate their floppy disk drive. Then I check if there's a disk in, if it's formatted and blank, prompting the user to format if otherwise.

Many thanks!
0
Comment
Question by:wjdashwood
3 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9883757
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 9883961
The above sample is the 'fully featured' version. The scoop basically is

    BROWSEINFO      bi;
    LPMALLOC        pMalloc =   NULL;    
    LPITEMIDLIST    pidl;
    char        acSrc   [   MAX_PATH];

    if  (   SHGetMalloc (   &pMalloc)   !=  NOERROR)
            return  (   ( char) 0);

    ZeroMemory  (   &bi,    sizeof  (   BROWSEINFO));

    bi.hwndOwner        =   hWnd;
    bi.pszDisplayName   =   acSrc;
    bi.ulFlags          =   BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS;
    bi.lpszTitle        =   "Please select floppy drive";

    if  (   pidl    =   SHBrowseForFolder   (   &bi))
        {
            if  (   !SHGetPathFromIDList    (   pidl, acSrc))
                    continue;

            // floppy path is now stored in 'acSrc'

            pMalloc->Free   (   pidl);
        }

    if  (   pMalloc)    
            pMalloc->Release();  

And to format a floppy, you could use http://www.codeproject.com/dialog/cformatdrivedialog.asp?target=shformatdrive
0
 

Author Comment

by:wjdashwood
ID: 9884045
Thanks I think I've got the idea.

Cheers
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 74
iSeries FTP Exit Program 8 135
windows 10 how make picture as desktop background 2 62
Unix Command -- Challenging  question 7 88
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

815 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

7 Experts available now in Live!

Get 1:1 Help Now