Solved

Common Dialogs in C++

Posted on 2000-03-15
5
244 Views
Last Modified: 2012-06-21
I am looking for a C++ call to make a common Dialog to appear on screen. The common Dialog I am looking for allows the user to select an output directory into which a file can be placed. What libraries do I need? Do you know of any Web sites which gives a list of these calls?
0
Comment
Question by:pbroe
  • 5
5 Comments
 
LVL 5

Expert Comment

by:Wyn
ID: 2620415
Plz Check
DlgDirList() function.

Regards


0
 
LVL 5

Expert Comment

by:Wyn
ID: 2620424
FYI:
 
The DlgDirList function fills the specified list box with the names of all files matching the specified path or filename.

int DlgDirList( HWND hDlg,
 // handle to dialog box with list box
 
LPTSTR lpPathSpec,
 // pointer to path or filename string
 
int nIDListBox,
 // identifier of list box
 
int nIDStaticPath,
 // identifier of static control
 
UINT uFileType
 // file attributes to display
 
);
   


Parameters
hDlg

Identifies the dialog box that contains the list box.

lpPathSpec

Points to a null-terminated string that contains the path or filename. DlgDirList modifies this string, which should be long enough to contain the modifications. For more information about this parameter, see the Remarks section.

nIDListBox

Specifies the identifier of a list box. If this parameter is zero, DlgDirList assumes that no list box exists and does not attempt to fill one.

nIDStaticPath

Specifies the identifier of the static control used for displaying the current drive and directory. If this parameter is zero, DlgDirList assumes that no such control is present.

uFileType

Specifies attributes of the filenames to be displayed. This parameter must be one or more of the following values: Value
 Description
 
DDL_ARCHIVE
 Includes archived files.
 
DDL_DIRECTORY
 Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
 
DDL_DRIVES
 Includes drives. Drives are listed in the form [-x-], where x is the drive letter.
 
DDL_EXCLUSIVE
 Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified.
 
DDL_HIDDEN
 Includes hidden files.
 
DDL_READONLY
 Includes read-only files.
 
DDL_READWRITE
 Includes read-write files with no additional attributes.
 
DDL_SYSTEM
 Includes system files.
 
DDL_POSTMSGS
 Posts messages to the application’s message queue. By default, DlgDirList sends messages directly to the dialog box procedure.
 


Return Values
If a listing is made ¾ even an empty listing ¾ the return value is nonzero. If the input string does not contain a valid search path, the return value is zero.

Remarks
If you specify a zero-length string for the lpPathSpec parameter or if you specify only a directory name with no filename, the string will be changed to *.*

The lpPathSpec parameter has the following form:

[drive:] [[\u]directory[\idirectory]\u] [filename]

In this example, drive is a drive letter, directory is a valid directory name, and filename is a valid filename that must contain at least one wildcard (? or *).

If lpPathSpec includes a drive or directory name, or both, the current drive and directory are changed to the specified drive and directory before the list box is filled. The static control identified by the nIDStaticPath parameter is also updated with the new drive or directory name, or both.

After the list box is filled, DlgDirList updates lpPathSpec by removing the drive or directory portion, or both, of the path and filename.

DlgDirList sends the LB_RESETCONTENT and LB_DIR messages to the list box.  
 







0
 
LVL 5

Expert Comment

by:Wyn
ID: 2620428
should be...
0
 
LVL 5

Accepted Solution

by:
Wyn earned 100 total points
ID: 2620454
And check
Dialog for selecting folders
http://www.codeguru.com/dialog/index.shtml
0
 
LVL 5

Expert Comment

by:Wyn
ID: 2620466
Quote some here...
char buff[1024];
ITEMIDLIST   list;
LPITEMIDLIST listP = &list;
BROWSEINFO   info;

info.hwndOwner = this->m_hWnd;
info.pidlRoot = NULL;
info.pszDisplayName = buff;
info.lpszTitle = "";
info.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS | BIF_VALIDATE;
info.lpfn = NULL;
info.lParam = 0;

listP = SHBrowseForFolder( &info );
if ( listP && SHGetPathFromIDList( listP, buff )){
// buff has the path now
  ...
}
else {
  ...
}  
 
 
 
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

777 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