Click here to Skip to main content
13,554,805 members
Click here to Skip to main content
Add your own
alternative version


7 bookmarked
Posted 15 May 2007
Licenced CPOL

AutoStart - Launch applications automatically when starting visual studio

, 15 May 2007
Rate this:
Please Sign up or sign in to vote.
This is an addin for visual studio 2003 and 2005, it launches applications which your defined automatically when starting visual studio


When I open visual studio to do some code work, I often need to run several utiltiy to help me make my work easy and with funs. I write this very simple addin to do these things automatically, when start visual studio, it load informations from an ini file, and launch the utility applications which I need, and close them when I exit visual studio.

Using the code

The code is very simple, there's only one class and several functions.

first the class CAppInfo, it descript the application we want to run:

class CAppInfo
 string strWindowTitle;    // the main window title
 string strAppPath;    // the application's exe file path
 BOOL bLoaded;    // indicate if the application is launch by this addin
 CAppInfo & operator =(CAppInfo & ai)
  strWindowTitle = ai.strWindowTitle;
  strAppPath = ai.strAppPath;
  bLoaded = ai.bLoaded;
  return * this;

Next one variable and four functions in CConect:

    list<cappinfo> AppList;    // store the applications info loaded from an ini file

    void LoadAppInfo(LPCTSTR strIniFile);    // load applications info from ini file
    void LaunchApp(CAppInfo & ai);    // launch an application
    void StartApp(LPCTSTR strIniFile);    // load applications info from ini file and launch then all
    void EndApp(void);    // close all launched applications 

Their functions descript in the comment.

Last, call our functions at appropriate time, in CConnect class:

STDMETHODIMP CConnect::OnStartupComplete (SAFEARRAY ** /*custom*/ )
    return S_OK;

STDMETHODIMP CConnect::OnBeginShutdown (SAFEARRAY ** /*custom*/ )
    return S_OK;

That's all.

The ini file

It use an ini file named AutoStart.ini to descript the applications info, it must be put to your system folder(C:\\windows or something like that).

if you want to launch "n" applications, it must have n sections. The sections named [Application 1], [Application 2], ..., [Application n], each section descripted an application. Below is a sample:

[Application 1]
WindowTitle="Perfect Keyboard - cpp.4pk"
AppPath="E:\Program Files\Perfect Keyboard AS\pk32.exe"
[Application 2]
AppPath="E:\Program Files\Hamsin Clipboard\HamsinClipboard.exe"

We use "ClassName" and "WindowTitle" to find the application's main window so we can close it by send a WM_CLOSE message when we exit the visual studio, so they are optional.

We need the "AppPath" to launch the application, so it necessary.


2007-05-16 original version posted.


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


About the Author

China China
No Biography provided

You may also be interested in...

Comments and Discussions

Rantthanks Pin
Milad.D23-Jun-10 0:33
memberMilad.D23-Jun-10 0:33 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180515.1 | Last Updated 15 May 2007
Article Copyright 2007 by Satervalley
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid