Making a program run on startup

This is a discussion on Making a program run on startup within the C Programming forums, part of the General Programming Boards category; I have a program that I wish to make windows run it as soon as windows starts up. How would ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    103

    Making a program run on startup

    I have a program that I wish to make windows run it as soon as windows starts up. How would I do this? Would it involve messing with the registry? If so, how would I do it?

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,788
    Copy it (a shortcut) to the startup folder. Or... add it as a scheduled task to be run on startup.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    See, I want I my program to do this automatically, without the user having to do anything. I'm sure you can do this because I've seen loads of programs that run once windows starts.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Well, since that's more of a Windows issue, you'd be better searching a Windows specific forum. Or, you know, just throwing a collection of seemingly random words at a search engine. Might I suggest the following, completely unrelated words:

    "windows programming C run at startup"

    I wrote a very complex random word generator, and that was the first thing that it gave me. I can run it again and give you more completely unrelated words if you need them. Honestly though, I'd just as soon not.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Poincare View Post
    See, I want I my program to do this automatically, without the user having to do anything. I'm sure you can do this because I've seen loads of programs that run once windows starts.
    You've been given the EXACT answer here:

    Copy it (a shortcut) to the startup folder. Or... add it as a scheduled task to be run on startup.
    Do you need to get it tattooed to your forehead or what?

    Right click on the program executable, and select "create a shortcut". Then drag that shortcut to the user's startup menu that you want:
    Documents and Settings\all users\Applications Data (AppData for Vista and Win7)\Start Up, iirc.

    And quit acting like you haven't been given the correct answer already.

    Cheers.

  6. #6
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by Adak View Post
    You've been given the EXACT answer here:



    Do you need to get it tattooed to your forehead or what?

    Right click on the program executable, and select "create a shortcut". Then drag that shortcut to the user's startup menu that you want:
    Documents and Settings\all users\Applications Data (AppData for Vista and Win7)\Start Up, iirc.

    And quit acting like you haven't been given the correct answer already.

    Cheers.
    I think you missed the "without the user doing anything" part
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Are you asserting that the start up folder won't start the programs which have shortcuts to them, inside that folder?

    The user doesn't have to do *anything* - even sign in, depending on which start up folder you choose.

  8. #8
    Registered User
    Join Date
    Dec 2008
    Posts
    104
    Quote Originally Posted by hk_mp5kpdw View Post
    Copy it (a shortcut) to the startup folder. Or... add it as a scheduled task to be run on startup.
    I'm sure his question was targeted at being more detailed in your latter option; adding it as a scheduled task to be run on startup.

  9. #9
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I believe he means he wants his program to add something to be started automatically, not doing it by hand.
    Having your program copy it to the startup folder would probably be the easiest way, but the location of the Startup folder changes with almost every version of Windows, so you'd need to find out which version of Windows you're on before you can know where to copy it...

    Using the registry might be better, but you'll have to read about the Registry API functions. Here's the location to add the program to:
    Code:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  10. #10
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    thanks a lot.

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,170
    Adding it to HKEY_LOCAL_MACHINE makes it start up for every user on the machine (and requires admin privileges).
    You can also add it to:
    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Curre ntVersion\Run
    Which makes it start for the current user, only. This does not require admin privileges.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to time how long a program takes to run?
    By advancedk in forum C Programming
    Replies: 2
    Last Post: 08-18-2008, 07:50 PM
  2. Get program to copy itself into program files, then start on startup.
    By guitarist809 in forum Windows Programming
    Replies: 6
    Last Post: 03-03-2008, 08:42 AM
  3. Replies: 2
    Last Post: 12-22-2006, 07:45 PM
  4. Replies: 5
    Last Post: 04-17-2003, 07:07 AM
  5. help making a program run
    By Dummies102 in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2002, 11:51 AM

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