GetOpenFileName Program-Defined Directory - c++

I want to create a dialog box that resembles the one created with GetOpenFileDialog. However, I want the dialog to display a list of filenames that the program provides, and these filenames don't necessarily exist as files in a directory. The purpose is to provide a dialog with a similar look and feel for opening files, but rather inside of a zip file which the program would extract after selection. So, is there any way this is possible?

No, you'll have to write one yourself. You can however find the common dialog box templates in the PlatformSDK\Include directory; you can use the FileOpen.dlg template to build a dialog similar to the standard Open dialog.

Related

is some special batch processing supported by Qt?

I want to use some special kind of batch processing. Say when executing in the menu system 'File Open filename', I store this text, and next time I "execute" that "batch" file. The File and Open recognized as menu items, and filename is used, without opening a dialog. Is this utilization supported by Qt? Or, at least finding a menu action?
The menu entries are QAction's. Those could easily be stored, but from your description it seems that you want to also store the filename. That means you want to store half a QAction; the part which asks for a filename but not the second part which uses that filename. That's not possible with Qt.
Of course, you can implement that yourself; after all it's your "File Open" menu entry.

Disabling/Enabling choose button of QFileDialog based on specific criteria

I have a QFileDialog prompting the user to select a directory. I am running QT version 4.3.5. I do not have the option of upgrading either.
I want the user to only be able to choose directories that contain two files with specific names. Something along the lines of disabling the "Choose" button if it does not contain these two specific files.
The searching I have done has only led me to ways of filtering the results, which is not what I want to do since the user needs to be able to browse all directories and all sub directories. If a directory is selected, then the check should be made to disable/enable the "Choose" button based on the above criteria.
Like I said, the only half close solutions I have found are explained in this thread QFileDialog for directories that have certain content
or this thread qfiledialog - Filtering Folders?
Both of those half solutions to my question require the use of QFileSystemModel, which wasn't introduced until QT 4.4.
How can I enable/disable the "Choose" button of a QFileDialog with QFileDialog::Directory set as the FileMode based on whether or not the selected/activated directory contains two specific files?
Thanks
You need to copy the file dialog's sources over to your project, modify the name of the class, and start tweaking it. That's the only way, unfortunately.

change file name when filter changes in Windows file save dialog from c++

In a Windows Save File dialog, I would like to automatically change the extension part of the filename in the edit box when the user changes the filter. That is, if the user is saving an image file, and changes the type to JPEG, the file name automatically changes to .jpg.
IIRC this used to be possible via hooks but that approach is no longer supported. Is there a way to accomplish it now? I'm using C++ (C++Builder if it makes any difference).
Thanks.

Contextual Menu to a Specific Folder

I have read how to add a contextual menu though registry to all files or files according the extension.
But how can I add a contextual menu that will work ONLY on files of a specific folder (for example on files of folder C:\contmenu)?
Can this be done?
Thanks a lot.
If you're implementing a context menu shell extension, you get the path of the item in your IShellExtInit::Initialize() method. Then you can decide depending on the path whether to add your entries to the context menu or not.
It's not possible to register an extension just for a specific path though.

Is there a standard directory browser dialogue in MFC that doesn't involve the user creating directories to specify ones that don't yet exist?

I am working on the bootstrap application of an installer, and I have a dialogue that the user can open to select a different target directory from the given default. Currently, I'm using the CFolderDialog for that, but for the user to select a folder that doesn't yet exist, he has to create the folder first. Once the user has specified the directory, I want to be able to delete it so that, when I launch the installer, it can create the folder itself such that it gets flagged for uninstall. Also, if the user cancels out of my bootstrap application at any time, I don't want any unwanted folders lying around from when the user mucked around in the folder browser. The problem that I'm having is that, if I try to remove the folder that the user created while browsing for a new target folder, I get a sharing violation error. (I compare the directory's creation time with what the system time was at the time the dialogue was launched to make sure that it's OK for me to delete the directory.)
What I need is either a way to get around that sharing violation or another standard dialogue that doesn't involve the user having to create a new directory in order to specify it just because it doesn't yet exist.
Edit: When I originally posted this, I forgot that the folder dialogue that I'm using is actually the XFolder Dialog on the Code Project site. While it does let the user browse for a directory, it's not as intuitive as folder browser dialogues that I've seen in installers in the past. What I'd really want is something where the user can browse to the folder in which their new folder is to go and then simply append the new folder to the path in the dialogue's edit box without having to create the new folder.
Update As the XFolder dialogue is a customization of the standard Open File dialogue which uses a template, it does not work on Vista or newer OSs. Because of this, I must abandon use of this for something else. I'm still looking for a solution here. If someone can show me how to set the initial directory (as opposed to the root directory) when using SHBrowseForFolder(), I'd be willing to use that as my solution.
For your purpose, it would probably make sense to let the user select a base directory, e.g. "C:\Program Files" (creating one in the process if so desired) and install into a subdirectory of that (a name which you append to the selected path and let your installer create). Display the combined path after the user has selected the base. This way, the user doesn't feel like he has taken on responsibility for the directory you're creating, but still has a reasonable level of control over the destination.
I have never seen such a dialog window, neither in MFC nor in any other technology. I agree with Shog9, you should provide the user with a way to separate the selection of a base directory and the creation of directories.
You can use SHBrowseForFolder without specifying neither BIF_BROWSEINCLUDEFILES or BIF_NONEWFOLDERBUTTON.