Fct_Open_DirName

 

Open a pop-up window with a directory browser.

 

 

Syntax

 

int  Fct_Open_DirName(

          char *title,

          char path[]

) ;

 

 

Parameters

 

title

A text string that will be displayed at the top of the window.

 

path

Pointer to a string that will be filled with the selected directory's path.

 

Return value

 

This function return "1" if the selection was successful.

 

 

Remarks

 

This function open a dialogue box using the "SHBrowseForFolder" mechanism.

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

 

Library:

          sliceO_Structures.lib

 

 

 

Example

 

// ====================================================================

// --- Scratch Directory ---

// ====================================================================

if ( but_temp_dir.Select( click ) ) {

 

          but_temp_dir.Cur_Value = 1 ;

          but_temp_dir.Adjust() ;

 

          char dir[MAX_PATH] ;

          int ret = Fct_Open_DirName( "Select the directory for all temporary files", dir ) ;

 

          if ( ret ) {

                    // --- make sure the directory exist ---

                    if ( ! Is_Dir( dir ) ) {

                        Error_Fct( hwnd, ERROR_CODE_ERROR, "Directory \"%s\" does not exist!", Scratch_Dir ) ;

                    } else {

                        // --- name should finish with a "\" ---

                        if ( dir[strlen(dir)-1] != '\\' )

                              strcat( dir, "\\" ) ;

                        strcpy( Scratch_Dir, dir ) ;

                    }

 

                    // --- re-write the value ---

                    text_temp.Read( Scratch_Dir ) ;

          }

 

          but_temp_dir.Cur_Value = 0 ;

          but_temp_dir.Adjust() ;

          but_temp_dir.Select( KEY_QUERY ) ;

}

 

See also