setting program for start up

This is a discussion on setting program for start up within the Windows Programming forums, part of the Platform Specific Boards category; I would like to set my program so that it executes itself automatically when the computer opens. Does anyone have ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    53

    Question setting program for start up

    I would like to set my program so that it executes itself automatically when the computer opens. Does anyone have any idea how i can do this?

    Thanks in advance...

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    You have to write it's complete path etc to one of the following registry keys... (open regedit and look to see the format)

    hkey_local_machine\software\microsoft\windows\curr entversion\run (for global startup)

    hkey_current_user\software\microsoft\windows\curre ntversion\run (for per user startup)

    BUT... let me caution you that starting stuff up indiscriminately can cause serious problems for both the system and the users.
    For example: If your program has per-user settings and you open it in hkey_local_machine, it's liable to error off significantly when a user tries to access it. So be very careful with this...

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    53
    how can i do that?
    is there a special function to do such a thing?

  4. #4
    Registered User
    Join Date
    Mar 2011
    Posts
    23
    RegCreateKeyEx, RegSetValueEx Function's. These aren't the easiest of API for a beginner to use. Search around for examples and keep an eye out for a registry wrapper class, there are a few I have seen written by people over the years and they make it simple to understand as the msdn can get confusing.


    EDIT: this looks alright
    Last edited by pYro; 04-30-2011 at 09:46 PM.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Actually you can #include <shlwapi.h> and use the SHSetValue() function, it's a lot simpler to use than the Reg* functions.

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    23
    yes that is far simpler, but if the user of your app has not installed IE past a certain version, the shell lightweight API may be missing and it has a terrible overhead for dependencies as it contains many completely unrelated API's.

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ummm... look it up... you're talking about IE 4... that's like 12 years ago...

    Just about anything still in use is going to have at least win2000 in it and shlwapi is completely implemented there.

    As far as dependencies go, shlwapi.dll is loaded by the shell at startup, so no increase in overhead...
    Last edited by CommonTater; 04-30-2011 at 10:11 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Start and kill program from within program
    By System_159 in forum Windows Programming
    Replies: 4
    Last Post: 09-10-2007, 04:01 PM
  2. best program to start
    By gooddevil in forum Networking/Device Communication
    Replies: 4
    Last Post: 05-28-2004, 05:56 PM
  3. Start up program
    By Breetai in forum Windows Programming
    Replies: 2
    Last Post: 01-11-2003, 12:12 PM
  4. start another program
    By lshome in forum C Programming
    Replies: 3
    Last Post: 06-24-2002, 01:48 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21