Click here to Skip to main content
15,886,806 members
Articles / Programming Languages / C#

Startup Edit

Rate me:
Please Sign up or sign in to vote.
3.25/5 (53 votes)
15 Apr 2010Ms-PL4 min read 72.9K   1.6K   41   17
This fully working program enables you to control what should and should not load automatically with Windows.

Image 1

the options dialog

the edit dialog

Introduction

What is Startup Edit

Startup Edit is a small program that might come in handy when it comes to:

  1. Preventing (spyware) programs from running behind your back without your knowledge.
  2. Maximizing your system resources by removing unwanted programs from starting with Windows.
  3. Decreasing the time taken by Windows to load.

Why is it useful

This fully working program enables you to control what should and should not load automatically with Windows. This way, you eliminate viruses, worms, and spyware threats which might take advantage of this feature. It loads itself every time you start your PC and starts recording activities (loggers, spyware), or looks for anything that destroys your valuable data (viruses).

Problems solved

If you:

  1. Fully understand what should and should not load with Windows
  2. Have the "Startup Edit" right in Your desktop

you will no longer need many of the privacy protector software out there.

Latest news

Startup Edit now supports the msconfig.exe utility by reading its disabled items and givinge the user the ability to re-enable it or delete it forever!! In the near future, Startup Edit will support the plug-in technology.

Background

Have you ever asked yourself how programs like Yahoo! Messenger, MSN, ICQ etc.. load every time Windows starts up? Normally, when a program needs to load every time Windows starts up, it uses one of two techniques. The first technique is using the Windows Registry, which is the most common way nowadays. The second technique is using the famous Windows Startup folder. We will discuss the two techniques quickly.

The first technique, using the Windows Registry: I will not discuss the Windows Registry itself. A program can write to the Registry in one of two keys: The first key, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\" holds three sub keys (Run, RunOnce, RunOnceEx), and used when the program has to be loaded globally (in all user accounts). The second key, "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\" holds two sub keys (Run, RunOnce), and is used when the program has to be loaded locally (just in this user account).

  • Run - Means load the program every time Windows starts.
  • RunOnce - Means load the program just the next time Windows starts, and then Windows automatically deletes the entry.
  • RunOnceEx - Not used except for the first time ever Windows starts (starts after the installation of Windows itself).

The second technique uses the Startup Folder: This is the old fashioned way to load programs and it is rarely used now (Microsoft Office still uses it). This folder is found in the "Documents and Settings" folder; each user account has one folder named after his user name. There is one common startup folder found in the "All Users" folder under "Documents and Setting\All Users\Start Menu\Programs\Startup" to load a program in all user accounts.

A Note: Windows NT has a feature called "services" which is an application type that runs in the background, and is similar to UNIX daemon applications. Service applications are typically client/server applications, Web Servers, database servers, and other server-based applications for users, both locally and across a network. And usually, they don't have a visible user interface, and most services start up automatically with Windows and do their job. This feature is not yet supported, but I might support it in the near future.

Program features

  1. Lists all entries found in the following Registry keys:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices (Win9x)
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce (Win9x)
    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
  2. Lists all entries found in the following folders:
    %SYSTEMDRIVE%\Documents and Settings\All Users\Start Menu\Programs\Startup
    %SYSTEMDRIVE%\Documents and Settings\YOUR_USER_NAME\Start Menu\Programs\Startup
  3. Enables you to remove any entry found in the list.
  4. Enables you to disable\enable any entry found in the list.
  5. Enables you to add\edit any entry to the list except to (Startup Folders).
  6. Enables you to launch and explore a folder or invoke its properties.
  7. Can differentiate between Win9x and WinNT, in general.
  8. Friendly user interface, easy to use.

The code: A closer look

Startup Edit has four forms: the Main form, the Edit form, the INI Editor form, and the Shutdown form.

Th method below removes any -, /, or , from the end of a string:

C#
public string AnalyzeIt ( string MyString )
{ 
    if ( MyString.StartsWith ( "RUNDLL32.EXE" ) || 
         MyString.StartsWith ( "rundll32.exe" ) )
    { 
        MyString = MyString.Remove (0, 12); 
    }

    MyString.Trim();
    int MyLenght = MyString.Length; 
    char[] cSlaHyp = {'-','/', '"',','}; 
    int iSlaHyp = 0;

    if ( MyString.StartsWith ( "\"" ) )
    {
        MyString = MyString.Substring ( 1 );
        MyString.Trim();
    }
    iSlaHyp = MyString.LastIndexOfAny ( cSlaHyp );

    if ( iSlaHyp > -1 )
    {
        MyString = MyString.Substring ( 0, iSlaHyp );
        MyString.Trim();
        MyString = AnalyzeIt ( MyString );
        MyString.Trim();
    }

    return MyString;
}

That's it!

I'm very open to any criticism, comments, suggestions, ideas, or thoughts for improvements. So don't hesitate if any comes to your mind.

To-do list

  1. Code enhancements
  2. Versioning the release
  3. More useful utilities

History

  • 3 Jan 2006: First upload.
  • 4 Jan 2006: A complete rewrite to the program, and I have added a new module.
  • 5 Jan 2006: Changed the screenshot and fixed spelling and grammar errors.
  • 15 Feb 2006: New version released.
  • 16 Feb 2006: StartUp Edit Version 0.1 alpha released.
  • 22 Feb 2006: StartUp Edit Version 0.2 alpha released.
  • 15 Apr 2010: StartUp Edit Version 0.2 beta released.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Architect YFA Corp
Egypt Egypt
Ahmad Mahmoud Cairo-Egypt
Deveoleping Windows Applications And Web Applications Using
C, C++, Visual C++ C#.Net & Asp.Net
And his Initial go Was With VB6
Now he's in To Java (Moving Merging...)

I learend a lot of stuff in CodeProject
you people are amazing
Good for you....
Thanks

Comments and Discussions

 
QuestionWRITING CRAP TO MY REGISTRY Pin
bloggs-was-here10-May-14 23:41
bloggs-was-here10-May-14 23:41 
GeneralSysinternals is more comprehensive Pin
John Brett15-Apr-10 5:38
John Brett15-Apr-10 5:38 
GeneralRe: Sysinternals is more comprehensive Pin
Ahmad Mahmoud [candseeme]17-Apr-10 23:46
Ahmad Mahmoud [candseeme]17-Apr-10 23:46 
GeneralRe: Sysinternals is more comprehensive Pin
John Brett18-Apr-10 22:36
John Brett18-Apr-10 22:36 
GeneralRe: Sysinternals is more comprehensive Pin
Ahmad Mahmoud [candseeme]19-Apr-10 2:22
Ahmad Mahmoud [candseeme]19-Apr-10 2:22 
Generalthank you Pin
Hasbi Allah10-Feb-08 5:34
Hasbi Allah10-Feb-08 5:34 
GeneralRe: thank you Pin
Ahmad Mahmoud [candseeme]21-Jul-08 1:05
Ahmad Mahmoud [candseeme]21-Jul-08 1:05 
GeneralUnstable Pin
Cliff Stanford14-Jan-07 1:16
Cliff Stanford14-Jan-07 1:16 
QuestionRe: Unstable Pin
Ahmad Mahmoud [candseeme]14-Jan-07 10:12
Ahmad Mahmoud [candseeme]14-Jan-07 10:12 
AnswerRe: Unstable Pin
Cliff Stanford15-Jan-07 2:38
Cliff Stanford15-Jan-07 2:38 
Generalto wish Pin
helpsoft.ru23-Feb-06 1:16
helpsoft.ru23-Feb-06 1:16 
GeneralRe: to wish Pin
Ahmad Mahmoud [candseeme]24-Feb-06 4:53
Ahmad Mahmoud [candseeme]24-Feb-06 4:53 
QuestionWhat's wrong with msconfig? Pin
nadav743-Jan-06 2:48
nadav743-Jan-06 2:48 
It seems to be an msconfig rewrite. So, other than the educational issue, what's the advantage?

AnswerRe: What's wrong with msconfig? Pin
Hal Angseesing3-Jan-06 6:23
professionalHal Angseesing3-Jan-06 6:23 
AnswerRe: What's wrong with msconfig? Pin
Ahmad Mahmoud [candseeme]3-Jan-06 10:03
Ahmad Mahmoud [candseeme]3-Jan-06 10:03 
AnswerRe: What's wrong with msconfig? Pin
[Marc]15-Feb-06 15:15
[Marc]15-Feb-06 15:15 
Answer[Message Removed] Pin
Mojtaba Vali22-Feb-06 9:24
Mojtaba Vali22-Feb-06 9:24 

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.