The RJ Journal - C++ - QDir

2007-07-11


Welcome

Electronics

Computers

Programming
General
Assembler
C
C++
C#
Flash

TV-Shows

Movies

Fun Stuff

Food & Drink

Sport

Model Crafts

In my mind

Photos

Making money on the net

Kids

Contact

News

 

 

 
   
Use "Quick Dir" if you have a lot of folders that you open on a regular basis. Sort of like a Favorites for Explorer.

Download executable. Instructions for installation
Download source. Instructions for compiling (right click, save as and rename extension to .zip).

I found myself opening a lot of explorer windows for different folders every day. The folders are also somewhat grouped according to what project I am working on. And then there are other folders which I also open a lot but these seems to be independent on what I do. I could just open a folder on the desktop and put shortcuts to these folders here but the desktop is normally hidden behind applications so...

I decided to make my own little program to open my "favorite" folders. Next to Explorer and IExplorer it is the program I use the most. It is basically a window with tabs where every tab is for one project or type of work I do. In each tab there is a list with folder names, or alias names which are easier to recognize. The names are actually commandline switches and arguments for explorer. The commandline switches and the program to open can be replaced which means that any program can be started.

Tabs can be added, removed or hidden. Folders can be dragged to the tab lists to add them to the current tab.

There is also one menu for common folders. This is a menu item instead of a tab since it should be accessible without changing to another tab. Another menu lets you select any drive in the system. A third menu displays all "special folders" such as Windows, System, Control panel, My Documents, My Pictures, Printers and so on.

The program is written in C++, is very small and as it is written it is supposed to be started from the aquickstart field in the taskbar (the one just to the right of the Start button) since then it only requires one click to start (if one instance is already running, focus is switched to the already running and the newly started is terminated). It automatically minimizes itself after 30 seconds of inactivity (time can be changed).

It is primarily written for XP but does also work under Vista but the commandline switches for explorer is then different. These can be changed in the setup file for the program.

The Acc column shows how many times a folder have been accessed from QDir. The Path column shows the path to the folder by default but can be changed to a custom text. Finally there is a column named ">". This column is used to open the path (or the application) with a single click. The other columns have to be double clicked to open the path. The list can be sorted by the Acc or the Path column. The currently used sorting is shown with a dot in the title.

Folders can be added to a tab, which is also called a Selection, with File->Add folder, File->Add Special folder or by dragging a folder (or several folders) from Explorer to the list. The list also has a context menu that can be used to add folders to it.

One context menu entry for the list is Properties. This opens the properties for an item in the list. This gives a possibility to change the text, the alias, for an item. The original path can also be displayed together with the alias. The Advanced... button opens the advanced properties where both the path, command switches and application used for the list item can be changed.

Here is the advanced properties dialog for a normal folder opened with explorer:

And here is an example that opens the textfile "userenv.log" with notepad.

The selections or tabs can be accessed through File->Selections... which opens a dialog where selections can be added, renamed, deleted or hidden.

The Change button is used to rename or hide a selection.


 

All settings for the application, the selections and items in the selections are in a file called QDIR2.CFG. This is a textfile with sections for each group of settings, much like an INI file. The first section named [Inställningar] ("settings" in Swedish) contains basic settings:

[Inställningar]
MinimizeTimeout 30,1
Default_arg "/e,,"
Default_exe "explorer.exe"
Selection "TMS Setup"
Lista 0
FönsterPos 0,750,373,421,0

The interesting settings here are:

MinimizeTimeout: The first argument is number of seconds until the QDir window minimizes itself and the second argument is 0 if the feature is disabled and 1 if it is enabled.

Default_arg: This is the default commandline switches that will be added to the application when a folder is added.

Default_exe: This is the default application to start a newly added folder with.

The other settings should not be touched and are used internally by QDIR to remember application variables through sessions.
 

Note that Default_arg and Default_exe only changes new items added to the lists. Existing items has to be changed through the Advanced properties dialog or directly in the QDIR2.CFG file.

Installation instructions

Download the executable here. Extract it to a folder of your preference. Create a shortcut to QDIR2.EXE and drag the shortcut to the quickstart field in the taskbar directly to the right of the start button.

Note to vista users: Change the Default_arg to "/e," (only one comma) and put the executable in a folder with write permissions for the application (C:\Program files is not a good location for this) since QDIR2.CFG needs to be changed by the application.

Compiling the code

The source code is compiled with Microsoft Visual C++, using MFC. The project is set up to put all output files under the folder mvs_output in the root of the drive where the source is compiled from. The bin folder contains the executable. If compiled for debug, the name is appended with _d.

Download by right click and save as. Rename extension to .zip (problems with downloading zip files).