Click here to Skip to main content
14,979,508 members
Articles / Desktop Programming / WTL
Article
Posted 8 Feb 2015

Stats

19.7K views
478 downloads
18 bookmarked

AppRunner – Simple ‘desktop shortcut’ replacement

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
8 Feb 2015CPOL4 min read
A WTL based, XML driven shortcut replacement

Introduction

AppRunner is a simple tool, used as a Windows desktop shortcut replacement. Shortcuts are organized in tabs and their content is defined in a simple xml file.

The advantages of using AppRunner over desktop icons are:

  • Icons can be organized via tabs
  • Icon legends appear in full (no ellipsis!)
  • Document, Folder and Application paths appear in full

Background

Part of our daily routine is to run multiple programs, open different directories and files, test multiple versions of applications, etc. My small team has to maintain many different versions of many different projects. Different versions of development tools (Visual Studio 10, 12, 13, Texas Instruments CCS 3.0, 5.0, 6.0) are used at different frequencies – daily, weekly, etc.

To keep up with all of this, we had been using desktop shortcuts to point to projects files, directories, test programs, etc. This approach was quite cumbersome, considering that we had to maintain this over multiple computers and multiple configurations.  AppRunner was developed to make these operations easier.

A quick tour

Here is a page of shortcuts:

Image 1

... and another

Image 2

The icons are grouped in tabs selected by the custom tab control on the left. Each tab contains multiple ‘shortcuts’ optionally separated by horizontal lines. Each shortcut represents a folder, file or an executable with optional command line arguments.

The icon for each shortcut is automatically retrieved, using the application specific icon. An invalid shortcut displays a red ‘X’ icon.

Configuring the tool

AppRunner is configured by an external .xml file, either supplied as a command line argument or named AppRunner.xml and located in the same directory as the AppRunner.exe. The xml file contains several sections as described below.

The sections are contained within the main root named AppRunner:

<AppRunner>
  ...
</AppRunner>

 

There are two different types of sections – CommandPage and Defines.

CommandPage: Each command page section contains information about the shortcuts in each tab page. Here is the CommandPage definition for the second page above:

   <CommandPage name="DarkStar">
      <Item name="Darkstar Folder->"                 cmd="%DarkStar%" />
      <Item name="Darsktar Solution"                 cmd="%VStudio2013% %DarkStar%\DarkStar.sln"/>
 
      <Separator name="TI Compilers"/>
      <Item name="TI CCS 6.0"                        cmd="C:\TI\ccsv6\eclipse\ccstudio.exe" />
      <Item name="TI CCS 3.0"                        cmd="C:\TI\CCS33\cc\bin\cc_app.exe" />
   </CommandPage>

The page contains 4 shortcuts and a separator line. The separator line has a single optional attribute (name) which specifies the title of the separator. If no name is specified, then a simple separator line is drawn.

The last two shortcuts are simple commands that point to the full path of an executable to run when the icon is hit. The first shortcut points to a folder specified by %DarkStar%. DarkStar is defined either as an environment variable or is defined in a Defines section as described below.

Defines: Here is a portion of the xml file that shows some defines:

   <Defines computer="Posidon">
      <Item name="Proj"               value="C:\_Proj" />
      <Item name="Data"               value="C:\Data" />
   </Defines>
   <Defines>
      <Item name="Program"            value="C:\Program Files (x86)" />
      
      <!-- Project Common -->
      <Item name="Proj"               value="D:\_Proj" />
      <Item name="Data"               value="D:\Data" />
   
      <!-- DarkStar -->
      <Item name="DarkStar"           value="%Proj%\_Active\Chronotek\Darkstar"/>
   </Defines>

 

Defines are grouped in one or more sections. An optional attribute (computer) is used to limit the definition to a specific computer.

Each section contains multiple variable definitions. The first definition encountered for a particular variable is the one used. As an example, the variable Proj will have the value C:\_Proj for the computer named Posidon and have the value D:\_Proj for all other computers.

The variable values may use variables defined previously. For example the variable DarkStar above will have the value D:\_Proj\_Active\Chronotek\Darkstar (for any computer not named Posidon).

Using the code

A Visual studio 2013 solution is included. The latest version is available at: https://github.com/tkontos/AppRunner

Recent versions of boost and WTL are the only external libraries required.

The most complicated part of setting up the Visual Studio project is the required external libraries configuration. This is a problem many developers face and we are no exception – our team's typical solution has more than 20 projects, most of them requiring boost, wtl, opencv, etc. The remainder of this section describes the approach we are using, which is based on importing solution and project level settings (Note: The project included with the source code has already been modified as described below).

Manually edit each project in the solution and add the following lines:

C++
   <Import Condition="Exists('$(SolutionPath).props')" Project="$(SolutionPath).props" />
   <Import Condition="Exists('$(ProjectName).props')" Project="$(ProjectName).props" />

This will import, if they exist, the settings from a solution level file (named ‘AppRunner.sln.props’ located in the same directory as the as the solution) and then a project level file (named ‘AppRunner.props’ located in the same directory as the project).  The easiest way to manually edit a project is to right-click the project in solution explorer and select Unload Project and then right click and select Edit.

These ‘props’ files specify additional include and library directories and any other settings (in this project the target directory is modified). For details, see the file AppRunnder.props included in the sources.

Another advantage of this approach is that multiple versions of external libraries may be used for different projects in the same solution.  In one of our solutions, a project requires boost 1.36.0 and another boost 1.57.0.

If you make changes to the code, improve it, or have some better ideas, I would love to hear from you.  Contact me at thanko [at] outlook [dot] com. Comments and suggestions are always welcome!

Points of Interest

The source code includes examples for the following:

  • XML File processing
  • Custom Tab Control
  • Simple Windows Animation
  • File icons
  • Restore Window position

History

Feb 6, 2015    Initial Release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

tkontos
Software Developer (Senior) 4NSystems
United States United States
As principal of a small consulting team, I have been developing software (mostly C++, occasionally C# and Matlab) for over 25 years. Our primary focus has been in two areas: embedded systems and opthalmic medical instrumentation with installations at tens of thousands of sites, both in clinical and industrial environments.

Expertise includes: GUI design, Internationalization, Graphics and image processing (OpenCV), Multi-platform C++ development, Instrument communications TI TMS320 embedded development, Secure embedded firmware distribution.

Client list includes: Alcon, Holladay Consulting, Malema, Carl Zeiss, AMO, SMC

Comments and Discussions

 
QuestionWTL 9.0 install issue Pin
YDLU11-Feb-15 6:58
MemberYDLU11-Feb-15 6:58 
AnswerRe: WTL 9.0 install issue Pin
tkontos11-Feb-15 10:36
Membertkontos11-Feb-15 10:36 
GeneralSpace Pin
TestCalls11-Feb-15 1:35
MemberTestCalls11-Feb-15 1:35 
GeneralRe: Space Pin
tkontos11-Feb-15 3:37
Membertkontos11-Feb-15 3:37 
GeneralRe: Space Pin
TestCalls11-Feb-15 4:18
MemberTestCalls11-Feb-15 4:18 
GeneralRe: Space Pin
tkontos11-Feb-15 5:04
Membertkontos11-Feb-15 5:04 
QuestionInteresting but ... Pin
sam.hill9-Feb-15 16:01
Membersam.hill9-Feb-15 16:01 
QuestionLooks interesting, is the source code coming? Pin
Phil.Benson8-Feb-15 21:53
professionalPhil.Benson8-Feb-15 21:53 
AnswerRe: Looks interesting, is the source code coming? Pin
tkontos9-Feb-15 1:52
Membertkontos9-Feb-15 1:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.