Functions

shelltests.cpp File Reference

#include "utility.h"
#include "shellclasses.h"
Include dependency graph for shelltests.cpp:

Go to the source code of this file.

Functions

int main ()

Function Documentation

int main (  )

Definition at line 78 of file shelltests.cpp.

References GetDesktopFolder(), HWND, FolderBrowser::IsOK(), and TEXT.

{
     // initialize COM
    ComInit usingCOM;


    HWND hwnd = 0;


    try {

         // example for retrieval of special folder paths

        SpecialFolderFSPath programs(CSIDL_PROGRAM_FILES, hwnd);
        SpecialFolderFSPath autostart(CSIDL_STARTUP, hwnd);

        cout << "program files path = " << (LPCTSTR)programs << endl;
        cout << "autostart folder path = " << (LPCTSTR)autostart << endl;

        cout << endl;


         // example for enumerating shell namespace objects

        cout << "Desktop:\n";
        dump_shell_namespace(GetDesktopFolder());
        cout << endl;

        cout << "C:\\\n";
        dump_shell_namespace(ShellPath("C:\\").get_folder());
        cout << endl;


         // example for calling a browser dialog for the whole desktop

        FolderBrowser desktop_browser(hwnd,
                                      BIF_RETURNONLYFSDIRS|BIF_EDITBOX|BIF_NEWDIALOGSTYLE,
                                      TEXT("Please select the path:"));

        if (desktop_browser.IsOK())
            MessageBox(hwnd, desktop_browser, TEXT("Your selected path"), MB_OK);


         // example for calling a rooted browser dialog

        ShellPath browseRoot("C:\\");
        FolderBrowser rooted_browser(hwnd,
                                     BIF_RETURNONLYFSDIRS|BIF_EDITBOX|BIF_VALIDATE,
                                     TEXT("Please select the path:"),
                                     browseRoot);

        if (rooted_browser.IsOK())
            MessageBox(hwnd, rooted_browser, TEXT("Your selected path"), MB_OK);

    } catch(COMException& e) {

        //HandleException(e, hwnd);
        cerr << e.ErrorMessage() << endl;

    }

    return 0;
}

Here is the call graph for this function:


ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage