I am looking for vista style folder browse dialog with abily to choose folder path only.
Looks like that:
I have checked the VistaBridge and Microsoft Code Pack API, but there are only dialogs for file opening.
Do you know how to call this dialog or some solutions to customize standart FileBrowseDialogs?
Thanks.
You need to use SHBrowseForFolder API to have that Dialog, full example and documentation can be found here:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762115(v=vs.85).aspx
Related
My application displays a grid of images. When the right mouse button is clicked a context menu is displayed where the first option is "Show in Explorer".
I was able to launch the default explorer on the directory by using:
QDesktopServices::openUrl(QUrl::fromLocalFile( directory ));
However I want also the file to be selected.
Is this possible? I suppose it should be, as many apps can do that.
openUrl is not suitable here. You need just start another process (with QProcess start or startDetached) with Windows explorer special arguments:
explorer.exe /select,"C:\pathTo\file.txt"
Ok, I want to thank #Chernobyl for his useful help.
However I've found a general solution posted here:
How to "Reveal in Finder" or "Show in Explorer" with Qt
It wasn't compiling at first because the QtCreator code is using a class called Environment which I tried to add to my project but that file then also includes others, etc. I checked and they are using it just to see if explorer.exe can be found on the system path. It was not so important (to me) so I removed that check and then I tested it. It's working perfectly. It's also supposed to work for Mac and Linux.
I have converted a MFC application which was run on VS2005 to VS2010
In there I've functionality to select either a file or folder from CSelectDialog and it worked fine.
But when I convert the project into VS2010 now I can select files only.
How can I get rid of that? I couldn't find any libraries that I can use for this.
Simply I want to select either a file or folder using MFC in VS2010
Don't consider this as a duplication of
https://stackoverflow.com/questions/15852106/how-to-use-open-file-dialog-to-select-either-a-file-or-a-folder-in-vc-mfc
or
How do you configure an OpenFileDialog to select folders?
Because those answers are not applicable to this.
The source has a lot of assumptions about the types and ids of child controls on the file dialog. And the assumptions are broken if the file dialog upgraded to vista style. You can use the bVistaStyle parameter in the constructor to disable the automatic upgrade.
SHBrowseForFolder with BIF_BROWSEINCLUDEFILES is the only documented way I know of to choose file and folder at once. You can also consider supporting Shell Data Transfer between Windows Explorer and your program (e.g. drag/drop, copy/paste).
It looks like you're using some code from CodeProject that may not be compatible with 2010. You should use the standard CFileDialog to avoid any compatibility issues.
I have a standard MFC application with its own icon, and when viewing the application file through explorer, the icon displays fine. I have to add a library however that also includes icons for its various windows, and when I do add it to the project, Windows Explorer displays one of these icons instead of mine. Is there any way to force explorer displaying a specific icon?
Thanks
Windows displays the first icon in the resource for the program itself, so you just need to make sure that your icon is listed first.
Hi people I been trying to do this the whole night, can somebody help me/guide me on this.
Details:
Not Visual Studio (using Geany).
I'm using A lightweight IDE, and projects option is not available.
Is for the .exe file output.
Please give me some guidance on this.
I use Resource Hacker for such tasks. This will add an existing icon to an EXE; you'll need another tool to make the actual icon.
I am guessing you are using Visual Studio since you are talking about Windows.
First go to "Resource View" (from menu: View → Other Window → Resource View). Then in "Resource View" navigate through resources, if any. If there is already a resource of Icon type, added by Visual Studio, then open and edit it. Otherwise right-click and select Add Resource, and then add a new icon.
Recompile your project and see if change takes effect.
Second way:
Use preprocessor directives in your resource script to choose your icon file.
You need to use the resource compiler rc.exe. You will also need to create a .rc file listing the resource (your icon). On compilation with rc.exe, you will get a .res file which should be passed to the linker.
I have a MFC Dialog Application. I would like to replace the application exe icon.
I open the default MFC icon eg. app.ico in the res folder using Axialis IconWorkshop.
Replace all images in the icon.
Save it to appA.ico.
Then I change Filename property of icon IDR_MAINFRAME to res\appA.ico.
Visual Studio icon editor shows the correct image.
But when I build the application, the icon associated to the app.exe still show MFC default icon.
What went wrong?
In these cases the Visual Studio designer is a little buggy (or, otherwise, by design but incomprehensible). It's best to edit the .rc code file and change the icon filename there.
I think I recall that it is the first icon in the .RC file that is used, no matter what you do, so you might have to edit the .RC file directly, like djeidot says.
Sometimes, Windows caches icons. It may not be a problem with your application. Try downloading something like Resource Hacker
and look at your exe file. If the icon looks right, there is an IconCache.db or similar in your appdata\Local folder (depending on Windows version). Delete that and reload Explorer.
One of the Visual Studio files caches some resources; unfortunately I can't remember which one at the moment. Rename those files with odd extensions to something else and try a rebuild.
I have same problem and solve it by this solution:
Build\Clean Solution
Copy appA.ico again into res folder
Rebuild project
I have same problem and solve it by :
1.clear solution
2.open task manager and goto details tab.
3.search for explorer.exe and right click on it and end task.
4.goto File->run new task, type explorer.exe
5.now build the solution and check application icon.