Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: What is the diff. between GDI and GDI+? Pin
Jay Beckert12-Jul-02 8:18
Jay Beckert12-Jul-02 8:18 
GeneralRe: What is the diff. between GDI and GDI+? Pin
NormDroid12-Jul-02 11:31
professionalNormDroid12-Jul-02 11:31 
GeneralRe: What is the diff. between GDI and GDI+? Pin
Jay Beckert12-Jul-02 18:30
Jay Beckert12-Jul-02 18:30 
QuestionCFileDialog, user specify directory only ? Pin
Robert Palma Jr.10-Jul-02 9:46
Robert Palma Jr.10-Jul-02 9:46 
AnswerRe: CFileDialog, user specify directory only ? Pin
Michael Dunn10-Jul-02 10:12
sitebuilderMichael Dunn10-Jul-02 10:12 
GeneralRe: CFileDialog, user specify directory only ? Pin
Robert Palma Jr.10-Jul-02 11:21
Robert Palma Jr.10-Jul-02 11:21 
GeneralRe: CFileDialog, user specify directory only ? Pin
Michael Dunn11-Jul-02 16:10
sitebuilderMichael Dunn11-Jul-02 16:10 
AnswerRe: CFileDialog, user specify directory only ? Pin
Desmond Mardle10-Jul-02 11:23
Desmond Mardle10-Jul-02 11:23 
Hi you can specify the path in the constructor to the directory. You can then set a flag in the constructor to default to the dirctory you have specified.

CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );

Parameters

bOpenFileDialog

Set to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.

lpszDefExt

The default filename extension. If the user does not include an extension in the Filename edit box, the extension specified by lpszDefExt is automatically appended to the filename. If this parameter is NULL, no file extension is appended.

lpszFileName

The initial filename that appears in the filename edit box. If NULL, no filename initially appears.

dwFlags

A combination of one or more flags that allow you to customize the dialog box. For a description of these flags, see theOPENFILENAME structure in the Win32 SDK documentation. If you modify the m_ofn.Flags structure member, use a bitwise-OR operator in your changes to keep the default behavior intact.

lpszFilter

A series of string pairs that specify filters you can apply to the file. If you specify file filters, only selected files will appear in the Files list box. See the Remarks section for more information on how to work with file filters.

pParentWnd

A pointer to the file dialog-box object’s parent or owner window.

Remarks

Call this function to construct a standard Windows file dialog box-object. Either a File Open or File Save As dialog box is constructed, depending on the value of bOpenFileDialog.

To allow the user to select multiple files, set the OFN_ALLOWMULTISELECT flag before calling DoModal. You need to supply your own filename buffer to accommodate the returned list of multiple filenames. Do this by replacing m_ofn.lpstrFile with a pointer to a buffer you have allocated, after constructing the CFileDialog, but before calling DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by m_ofn.lpstrFile.

To allow the user to resize an Explorer-style dialog box using either the mouse or keyboard, set the OFN_ENABLESIZING flag. Setting this flag is necessary only if you provide a hook procedure or custom template. The flag works only with an Explorer-style dialog box; old-style dialog boxes do not permit resizing.

The lpszFilter parameter is used to determine the type of filename a file must have to be displayed in the file list box. The first string in the string pair describes the filter; the second string indicates the file extension to use. Multiple extensions may be specified using ‘;’ as the delimiter. The string ends with two ‘|’ characters, followed by a NULL character. You can also use a CString object for this parameter.

For example, Microsoft Excel permits users to open files with extensions .XLC (chart) or .XLS (worksheet), among others. The filter for Excel could be written as:

I will send you an example tomorrow when I return to work.

Hope this helps


Des Mardle
AnswerRe: CFileDialog, user specify directory only ? Pin
Desmond Mardle11-Jul-02 4:43
Desmond Mardle11-Jul-02 4:43 
GeneralRe: CFileDialog, user specify directory only ? Pin
Robert Palma Jr.11-Jul-02 10:36
Robert Palma Jr.11-Jul-02 10:36 
QuestionMem Usage??? Pin
Srini Kella10-Jul-02 9:17
Srini Kella10-Jul-02 9:17 
AnswerRe: Mem Usage??? Pin
DanielP10-Jul-02 9:26
DanielP10-Jul-02 9:26 
Generalhelp with templates and __declspec(dllexport) Pin
Roman Nurik10-Jul-02 9:13
Roman Nurik10-Jul-02 9:13 
GeneralRe: help with templates and __declspec(dllexport) Pin
Joaquín M López Muñoz10-Jul-02 9:34
Joaquín M López Muñoz10-Jul-02 9:34 
GeneralRe: help with templates and __declspec(dllexport) Pin
Roman Nurik10-Jul-02 9:36
Roman Nurik10-Jul-02 9:36 
GeneralRe: help with templates and __declspec(dllexport) Pin
Roman Nurik10-Jul-02 9:38
Roman Nurik10-Jul-02 9:38 
GeneralCArray problem with VS.Net Pin
LukeV10-Jul-02 9:11
LukeV10-Jul-02 9:11 
GeneralRe: CArray problem with VS.Net Pin
LukeV10-Jul-02 9:19
LukeV10-Jul-02 9:19 
QuestionToggle Window/Control Visibility? Pin
clintsinger10-Jul-02 9:03
clintsinger10-Jul-02 9:03 
AnswerRe: Toggle Window/Control Visibility? Pin
DanielP10-Jul-02 9:10
DanielP10-Jul-02 9:10 
QuestionWINAPI Function - NT Only!? Pin
carp10-Jul-02 8:42
carp10-Jul-02 8:42 
AnswerRe: WINAPI Function - NT Only!? Pin
Jeremy Falcon10-Jul-02 8:57
professionalJeremy Falcon10-Jul-02 8:57 
AnswerRe: WINAPI Function - NT Only!? Pin
Chad Koehler10-Jul-02 10:16
Chad Koehler10-Jul-02 10:16 
AnswerRe: WINAPI Function - NT Only!? Pin
Mike Nordell11-Jul-02 1:36
Mike Nordell11-Jul-02 1:36 
Generalbuttons don't change color in dialog Pin
jimNLX10-Jul-02 8:04
jimNLX10-Jul-02 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.