If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

There was an "impovement" since Windows 7 in algorithm for selecting the initial directory, which is described here OPENFILENAME structure. Briefly:

Windows 7:

If lpstrInitialDir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory.

Otherwise, if lpstrFile contains a path, that path is the initial directory.

Otherwise, if lpstrInitialDir is not NULL, it specifies the initial directory.

If lpstrInitialDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory.

Otherwise, the initial directory is the personal files directory of the current user.

Otherwise, the initial directory is the Desktop folder.

The problem that this behavior is not what users of my program expect. Another constraint is that I need to use old CFileDialog dialog, not Common File Dialogs. I've tried to use advises described on StackOverflow and on MSDN. This solution by EllisMiller works perfectly:

specifying a full path (including filename) in lpstrFile. The filename of course shows up in the filename box which is annoying. I ended up using a filename of "." and adding a bit of code to clear the filename combobox once the dialog is open.

BUT I can't figure how to clear the filename combobox. I've tried to add hook procedure, enumerate windows and clear text, but this didn't work for me. So, my question is: how can I clear text in the filename combobox of CFileDialog? Thanks in advance for any help!

There was an "impovement" since Windows 7 in algorithm for selecting the initial directory, which is described here OPENFILENAME structure. Briefly:

Windows 7:

If lpstrInitialDir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory.

Otherwise, if lpstrFile contains a path, that path is the initial directory.

Otherwise, if lpstrInitialDir is not NULL, it specifies the initial directory.

If lpstrInitialDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory.

Otherwise, the initial directory is the personal files directory of the current user.

Otherwise, the initial directory is the Desktop folder.

The problem that this behavior is not what users of my program expect. Another constraint is that I need to use old CFileDialog dialog, not Common File Dialogs. I've tried to use advises described on StackOverflow and on MSDN. This solution by EllisMiller works perfectly:

BUT I can't figure how to clear the filename combobox. I've tried to add hook procedure, enumerate windows and clear text, but this didn't work for me. So, my question is: how can I clear text in the filename combobox of CFileDialog? Thanks in advance for any help!

I'd probably look into deriving a class from CFileDialog and overriding whatever behaviors you want to change.

Well.. I've tried to add callback function using member lpfnHook of OPENFILENAME, then enumerate through windows and clear text. It didn't work. Then I've tried to get combobox by ID, using IDs from <Dlgs.h> and set text in OnInitDialog and OnInitDone methods. It didn't work. I've tried to use SetWindowsHookEx and catch message that (that was my assumption) will set text to combobox (because I've assumed that message WM_SETTEXT will be used). It didn't work. So I really need any suggestions, how new text can be set.

Step into the CFileDialog code and see where it's setting your initial directory whatever the problem is you're trying to fix. Write your own function in your own class and change the behavior to whatever you want. Without doing it myself, I can't give you anything more specific than that.

Step into the CFileDialog code and see where it's setting your initial directory whatever the problem is you're trying to fix. Write your own function in your own class and change the behavior to whatever you want. Without doing it myself, I can't give you anything more specific than that.

First note that old-style/non-Vista File Open/Save As dialogs are also in the Common Dialogs category, i.e. often used dialog boxes, which can be easily shown by calling specific Windows API functions (e.g. GetOpenFileName and GetSaveFileName).

First note that old-style/non-Vista File Open/Save As dialogs are also in the Common Dialogs category, i.e. often used dialog boxes, which can be easily shown by calling specific Windows API functions (e.g. GetOpenFileName and GetSaveFileName).

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.