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.
Related
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.
I am trying to overload the CFiledialog class to add functionalities as per my need. I am not getting the solution for restricting user from changing folder in certain situation as mentioned below.
When user is attempting to change folder.
I need to check if there any folder is selected or not?
If selected I need to check, if any of the selected folder is containing the desired file or not?
If the selected folder is having the desired file, then in such case I want to disable the change folder functionality.
I have tried to override virtual void OnFolderChange(); function, but call to this function comes after the folder is already changed.
Any suggestion will be greatly appreciated!
Thanks
I overridden the default handler for IDOK(ie Open button). Same as explained in the article in the link below.
http://www.codeguru.com/cpp/controls/toolbar/miscellaneous/article.php/c5497/Adding-Toolbar-button-in-CFileDialog.htm
I want to add an option to explorer (in windows) like the 'preview pane' but only an 'edit pane'. The idea is that I have text files that I want to edit, but I dont want to open an application to edit the file. I want to just click over in the edit pane and make the edits. Any suggestions what API's I can use to extend explorer in this way? (More than just 'look at the shell api: I have and I dont know which will allow me to accomplish this).
You have to implement PropertyHandler.
See Windows SDK \Samples\winui\Shell\AppShellIntegration\PropertyHandlers.
Each property is described by property schema XML file. This property schema must be registered with PSRegisterPropertySchema(). Property handler implements IInitializeWithXXX, IPropertyStore and optionally IPropertyStoreCapabilities. You have to register CLSID of your implementation for each file extension you want to handle (.txt in your case).
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.
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.