Easy Thumbnails
Written by Harry Fairhead   
Friday, 31 July 2009
Article Index
Easy Thumbnails
Thumber
Creating the shortcut
The UI
Converting the list
Improving the thumbnails

 

Auto To Send installation

We could ask the user to install our utility into the To Send directory but it’s not too difficult to do the job automatically.

Start a new C# Windows project called Thumber. The first task is to get the command line arguments.

The simplest way to get the command line arguments is using the Environment class. In the Form’s constructor add:
public Form1()
{
InitializeComponent();
m_args =
Environment.GetCommandLineArgs();

We also need a global variable to store the arguments:

private string[] m_args;

The Environment class also returns the first element of the array containing the name of the executable program. Unfortunately some versions of Windows return this with a full path name and others just the name of the executable, which makes it more difficult to use.

We can assume that if the program is run with no additional command line arguments it hasn’t been started via the Send To command – because if it had there would be the name of at least one file passed to it.

If it is run in this way we can set things up so that it installs itself into the Send To directory, i.e. running the application directly installs it.

In a more sophisticated installation we could add a popup dialog box that asks the user if they really want to install it and give them installation/uninstallation options.

We need the location of the Send To directory for the current user and the current directory where the executable is stored – and both are remarkably easy to get again with the help of the Environment class:

if (m_args.Length == 1)
{
string SendToDir =
Environment.GetFolderPath(
Environment.SpecialFolder.SendTo);
string ProgramPath =
Environment.CurrentDirectory;

You can get the location of any special folder in the same way.

<ASIN:0735623945>

<ASIN:0735626588>

<ASIN:1568813341>



Last Updated ( Friday, 31 July 2009 )
 
 

   
RSS feed of all content
I Programmer - full contents
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.